I've been tasked with parameterizing queries in an old classic asp site. Everything has been fine. When parameterizing this particular query, I have been getting this error description:
[Microsoft][ODBC SQL Server Driver]COUNT field incorrect or syntax error
SQL SERVER 2000.
Microsoft Visual InterDev.
This same approach has worked with other queries on the site.
Example of query:
What I changed it too:
Any suggestions? I'm at a lost.
[Microsoft][ODBC SQL Server Driver]COUNT field incorrect or syntax error
SQL SERVER 2000.
Microsoft Visual InterDev.
This same approach has worked with other queries on the site.
Example of query:
Code:
mSQL = "SELECT var1, var2 FROM table WHERE var3='" & Session("name") & "'"
Set mRS = Server.CreateObject("ADODB.Recordset")
mRS.CursorLocation = 3
mRS.Open mSQL, Conn, 0, 1
What I changed it too:
Code:
Dim mCmdObj
Set mCmdObj = Server.CreateObject("ADODB.Command")
mCmdObj.ActiveConnection = Conn
mCmdObj.Parameters.append(mCmdObj.CreateParameter("@Name", adChar, adParamInput, 10, Session("name")))
mCmdObj.CommandType = adCmdText
mCmdObj.CommandText = "SELECT var1, var2 FROM table WHERE var3 =?"
Set mRS = Server.CreateObject("ADODB.Recordset")
Set mRS = mCmdObj.Execute
Any suggestions? I'm at a lost.