I want to add a new record to database, and then retrives the @@IDENTITY value for this ne
added record, and the fields of this record. However, it has the following error on
line varNewID = objRS("NewMsgID"
ADODB.Recordset (0x800A0CC1
Item cannot be found in the collection corresponding to the requested name or ordinal
sqlStmt= "INSERT INTO AddressValidation "
& "(RequestXML, ResponseXML) "
& "VALUES ("
& "'" & strRequestXML & "'" & ","
& "'" & strResponseXML & "'" & ");
sqlStmt = sqlStmt & "SELECT @@IDENTITY AS NewMsgID;
Set objConn=Server.CreateObject("ADODB.Connection"
objConn.Open strConnec
Set objRS = objConn.Execute(sqlStmt
varNewID = objRS("NewMsgID") '<============= ERROR HERE!!
Response.Write "varNewID = " & varNewID & "<BR>
sqlStmt = sqlStmt & "SELECT * FROM AddressValidation WHERE AddressValidationID = " & "'" & varNewID & "'" & ";
Set objRS = objConn.Execute(sqlStmt
varXMLRequest = objRS("RequestXML"
varXMLRequest = objRS("ResponseXML"
Response.Write "varXMLRequest = " & varXMLRequest & "<BR>
Response.Write "varXMLRequest = " & varXMLRequest & "<BR>
objConn.Close(
Set objConn = Nothin
Set objRS = Nothing