Parameter object is improperly defined. Inconsistent or incomplete information was provided.
发布时间:2026-09-11 | 浏览:1
Access to this page requires authorization. You can try signing in or changing directories .
Access to this page requires authorization. You can try changing directories .
Tuesday, January 26, 2010 1:15 PM
I am getting this error on the line " Set rs = cmd.Execute(,arParams,1)"
can anyone help? Also if you can walk me through the vb script stuff I am just starting out and dont have many resources.
<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%> <% strConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\temp\db1.mdb" '"Data Source=127.0.0.1;Initial Catalog=NorthWind;Integrated Security=SSPI;" Set Conn = Server.CreateObject("ADODB.Connection") Conn.Open strConn query = "SELECT * FROM Customers WHERE CustomerID = ?" CustomerID = Request.QueryString("CustomerID") arParams = array(CustomerID) Set cmd = Server.CreateObject("ADODB.Command") cmd.CommandText = query Set cmd.ActiveConnection = Conn Set rs = cmd.Execute(,arParams,1) If Not rs.EOF Then Response.Write "{""j"":[{""__type"":""Customer""," & _ """CompanyName"":""" & rs("CompanyName") & """," & _ """Address"":""" & rs("Address") & """," & _ """City"":""" & rs("City") & """," & _ """Region"":""" & rs("Region") & """," & _ """PostalCode"":""" & rs("PostalCode") & """," & _ """Country"":""" & rs("Country") & """," & _ """Tel"":""" & rs("Phone") & """}]}" End If rs.Close : Set rs = Nothing : Set cmd = Nothing : Conn.Close : Set Conn = Nothing Response.End() %>
All replies (1)
Friday, January 29, 2010 3:14 AM ✅Answered
It seems you are using server-side automation of Office. We do not recommend or support server-side Automation of Office. For more information about the complications and alternatives, please refer to:
Considerations for server-side Automation of Office http://support.microsoft.com/kb/257757
query = "SELECT * FROM Customers WHERE CustomerID = ?" CustomerID = Request.QueryString("CustomerID") arParams = array(CustomerID) Set cmd = Server.CreateObject("ADODB.Command") cmd.CommandText = query Set cmd.ActiveConnection = Conn Set rs = cmd.Execute(,arParams,1)
The error indicates the parameter object is improperly defined.
If you want to use parameter, you must create the parameter object by using Set objParameter = Server.CreateObject("ADODB.Parameter") or invoke the cmd.CreateParameter method create a parameter object, then add the new parameter to the collection by using cmd.Parameters.Append objParameter.
You can also simply don’t use parameter in SQL query CustomerID = Request.QueryString("CustomerID") query = "SELECT * FROM Customers WHERE CustomerID = " & CustomerID '... Set rs = cmd.Execute(,,1)
There are some ADO samples in the following link, hope helps ADO Examples http://www.w3schools.com/ADO/ado_examples.asp
Additional resources
Last updated on 2010-01-26