Wrox Home  
Search P2P Archive for: Go

  Return to Index  

access_asp thread: ADODB Error


Message #1 by "Mitten" <mittenshah@h...> on Thu, 16 Aug 2001 22:16:52
Hello, I m trying to insert data through a form but im getting a following 

error message? can anyone tell me whats wrong with my code?





ADODB.Command error '800a0cc1' 



Item cannot be found in the collection corresponding to the requested name 

or ordinal. 



Here is my code:



<%

Dim 

objRS,objRS1,objComm,objComm1,objComm2,objComm3,objComm4,objParam,objParam1

,strSQL

Dim strFName,strLName

Dim 

strLatexID,strYear,strBookTitle,strLocation,strProceedingTitle,strFPage,str

LPage,strISBN

Dim objAthrID

Dim objProcedID

Dim objWrites



Set objComm = Server.CreateObject("ADODB.Command")



objComm.ActiveConnection = strConnect

objComm.CommandText = "qryAuthor"

objComm.CommandType= adCmdStoredProc



Set objParam = _

objComm.CreateParameter("Required First",adVarChar,adParamInput,50)

objComm.Parameters.Append objParam



Set objParam = _

objComm.CreateParameter("Required Last",adVarChar,adParamInput,50)

objComm.Parameters.Append objParam



strFName = Request.Form("FName")

objComm.Parameters("Required First") = strFName



strLName = Request.Form("LName")

objComm.Parameters("Required Last") = strLName



Set objRS = objComm.Execute

Set objComm = Nothing

Set objParam = Nothing





Set objComm1 = Server.CreateObject("ADODB.Command")



objComm1.ActiveConnection = strConnect

objComm1.CommandText = "qryProceeding1"

objComm1.CommandType= adCmdStoredProc



Set objParam1 = _

objComm1.CreateParameter("latexID",adVarChar,adParamInput,50)

objComm1.Parameters.Append objParam1



Set objParam1 = _

objComm1.CreateParameter("Book Title",adVarChar,adParamInput,50)

objComm1.Parameters.Append objParam1



Set objParam1 = _

objComm1.CreateParameter("Year",adVarChar,adParamInput,50)

objComm1.Parameters.Append objParam1



Set objParam1 = _

objComm1.CreateParameter("Proceeding Title",adVarChar,adParamInput,50)

objComm1.Parameters.Append objParam1





Set objParam1 = _

objComm1.CreateParameter("FPage",adVarChar,adParamInput,50)

objComm1.Parameters.Append objParam1



Set objParam1 = _

objComm1.CreateParameter("LPage",adVarChar,adParamInput,50)

objComm1.Parameters.Append objParam1





Set objParam1 = _

objComm1.CreateParameter("Location",adVarChar,adParamInput,50)

objComm1.Parameters.Append objParam1



Set objParam1 = _

objComm1.CreateParameter("ISBN",adVarChar,adParamInput,50)

objComm1.Parameters.Append objParam1







strLatexID = Request.Form("LatexID")

objComm1.Parameters("latexID") = strlatexID



strBookTitle = Request.Form("BookTitle")

objComm1.Parameters("BookTitle") = strBookTitle



strYear = Request.Form("Year")

objComm1.Parameters("Year") = strYear





strProceedingTitle = Request.Form("ProceedingTitle")

objComm1.Parameters("ProceedingTitle") = strProceedingTitle



strFPage = Request.Form("FPage")

objComm1.Parameters("FPage") = strFPage



strLPage = Request.Form("LPage")

objComm1.Parameters("LPage") = strLPage



strISBN = Request.Form("ISBN")

objComm1.Parameters("ISBN") = strISBN





strLocation = Request.Form("Location")

objComm1.Parameters("Location") = strLocation





Set objRS1 = objComm1.Execute

Set objComm1 = Nothing

Set objParam1 = Nothing





Set objComm2 = Server.CreateObject("ADODB.Command")

objComm2.ActiveConnection = strConnect



objComm2.CommandText = "SELECT MAX(ProceedingID) FROM Proceedings"

objComm2.CommandType = adCmdText



'Set objAthrID = objComm2.Execute

'Set objComm2 = Nothing





Set objComm3 = Server.CreateObject("ADODB.Command")

objComm3.ActiveConnection = strConnect



objComm3.CommandText = "SELECT MAX(AuthorID) FROM Author1"

objComm3.CommandType = adCmdText



'Set objArtcleID = objComm3.Execute

'Set objComm3 = Nothing





Set objComm4 = Server.CreateObject("ADODB.Command")

objComm4.ActiveConnection = strConnect



objComm4.CommandText = "INSERT INTO Writes1 (ProceedingID,AuthorID)" &_

							"SELECT MAX

(Proceedings1.ProceedingID), MAX(Author1.AuthorID)" &_

							"FROM 

Proceedings1,Author1"

objComm4.CommandType = adCmdText



Set objWrites = objComm4.Execute

Set objComm4 = Nothing



Set objAthrID = objComm2.Execute

Set objComm3 = Nothing



Set objProcedID = objComm3.Execute

Set objComm2 = Nothing



%>
Message #2 by "Tony Perrin" <a.c.perrin@i...> on Fri, 17 Aug 2001 11:39:51
    Set objWrites = objComm4.Execute

    Set objComm4 = Nothing



    Set objAthrID = objComm2.Execute

--> Set objComm3 = Nothing



--> Set objProcedID = objComm3.Execute

    Set objComm2 = Nothing



It appears as though you are setting objComm3 to Nothing and then trying 

to use it in the very next line.



Hope this helps



Tony Perrin


  Return to Index