I am working on a classic ASP web application In that I have a requirement of inserting 100 records (no. of records may change it depends on particular user selection). For this I am using parameterized query and prepared statement my code is as follows:
Set objComm2=Server.CreateObject("ADODB.Command")
objComm2.ActiveConnection=stConnect
objComm2.Prepared=true
objComm2.CommanText="insert into trader(RegistrationID,SalesID) values (?,?)"
objComm2.Parameters.Append objComm2.CreateParameter("@RegistrationID", adInteger, adParamInput)
objComm2.Parameters.Append objComm2.CreateParameter("@SalesID", adInteger, adParamInput)
while NOT objSel.EOF
objComm2("RegistrationID") = Session("RegistrationID")
objComm2("SalesID") = objSel("SalesInventoryID")
objComm2.Execute
objSel.MoveNext
wend
Here stConnect
contains connection variables defind in my project web config file, objSel
(its a record set object) contains required data to supply for insert operation.
Now my problem is when I am running this code I am getting the following error in appending parameters to command object:
Parameter object is improperly defined. Inconsistent or incomplete information was provided.
I couldn't find any error in my code.