I'm primarily an PHP developer, but I have some old ASP one of our previous developers made that broke and I can't figure out how to fix it. We have a program that sends some variables to a listener page that compares that data to registration codes an msSQL database and then lets the program know if the registration code is valid.
I'm getting the following error where
.Parameters.Append .CreateParameter("@code", adVarChar, 1, 50, x)
is line 134:
ADODB.Parameters error '800a0e7c'
Parameter object is improperly defined. Inconsistent or incomplete information was provided.
/checkregistrationpro.asp, line 134
I've already specified any named constants in an include file that I have not included in the code, so it isn't to do with that.
My Connection String (I've already verified that these settings are right):
set conn = Server.CreateObject("ADODB.Connection")
set cmd = Server.CreateObject("ADODB.Command")
sConnString = "Provider=sqloledb; Data Source=MYDATASOURCE; Initial Catalog=MYCATALOG; User ID=MYUSERID; Password='MYPASSWORD';"
conn.Open sConnString
My Code:
...
Function BlockInjectCode(StrVal)
BlockInjectCode = Replace(StrVal,"--","")
BlockInjectCode = Replace(BlockInjectCode,"'","")
BlockInjectCode = Replace(BlockInjectCode,"""","")
if instr(lcase(BlockInjectCode),"<") > 0 then
BlockInjectCode = ""
end if
End Function
x = BlockInjectCode(Request.QueryString("rid"))
uid = BlockInjectCode(Request.QueryString("uid"))
chkcode = BlockInjectCode(Request.QueryString("Code"))
CheckPro = BlockInjectCode(Request.QueryString("pro"))
CheckProProd = BlockInjectCode(Request.QueryString("prod"))
CheckProMac = BlockInjectCode(Request.QueryString("mac"))
MacAdd = CheckProMac
CodeValid = False
if x <> "" and uid <> "" then
'-- Get information about this registration code.
sqlStr = "select * from MYTABLE where Code = ? and IsValid = 1"
set cmdCodes = Server.CreateObject("ADODB.Command")
Set cmdCodes.ActiveConnection = Conn
cmdCodes.CommandText = sqlStr
with cmdCodes
.Parameters.Append .CreateParameter("@code", adVarChar, 1, 50, x)
end With
Set rsCodes = cmdCodes.execute
...