Jump to content

Errors in my Update page.


Splurd
 Share

Recommended Posts

I'm having trouble with my update db page, and so I've included the code.The table I have, has some values as numbers and some as String, I'm not 100% sure if that is causing the problem.

Microsoft OLE DB Provider for ODBC Drivers error '80040e21'Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done./TestDB/Version4/update_entry.asp, line 49
^^^This is the error that I am getting
<%'Dimension variablesDim adoCon    'Holds the Database Connection ObjectDim rsUpdateEntry  'Holds the recordset for the record to be updatedDim strSQL 	 'Holds the SQL query for the databaseDim lngRecordNo 	 'Holds the record number to be updatedDim Primekey 	 'Holds the primarykey nameDim keyno    'Holds the primarykey value,  must be numberDim table1   	 'table name,'Read in the record number to be updatedtable1 = Request.Form("table1")if table1 = "sg_test" OR table1 = "False_tb" then 	primekey = "SN"elseif  table1="Contact_tb" OR table1 ="User_tb" then	primekey = "Account_ID"elseif  table1="Warrenty2_tb"  Or table1="Warrenty_tb" then	primekey = "ID"end ifkeyno =  Request.Form("keyno")'Create an ADO connection odjectSet adoCon = Server.CreateObject("ADODB.Connection")'Set an active connection to the Connection object using a DSN-less connectionadoCon.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("db1.mdb")'Create an ADO recordset objectSet rsUpdateEntry = Server.CreateObject("ADODB.Recordset")'Initialise the strSQL variable with an SQL statement to query the databasestrSQL = "SELECT " & table1 & ".* FROM " & table1 & " WHERE " & primekey & "=" & keyno'strSQL = "SELECT sg_test.* FROM sg_test WHERE SN ='" & Request.Form("ID_no") & "'"response.Write(strSQL & "<br>" )'Set the cursor type we are using so we can navigate through the recordsetrsUpdateEntry.CursorType = 2'Set the lock type so that the record is locked by ADO when it is updatedrsUpdateEntry.LockType = 3'Open the tblComments table using the SQL query held in the strSQL varaiablersUpdateEntry.Open strSQL, adoCon'Update the record in the recordset'rsUpdateEntry.Fields("CONTACT_NO") = Request.Form("CONTACT_NO")	  for each x in rsUpdateEntry.Fields       rsUpdateEntry.Fields(Cstr(x.name)) = Request.Form(x.name)    next'Write the updated recordset to the databasersUpdateEntry.Update'Reset server objectsrsUpdateEntry.CloseSet rsUpdateEntry = NothingSet adoCon = Nothing'Return to the update select page incase another record needs deletingResponse.Redirect "update_select.asp"%>

^^^This is my code.Any views on this?

Link to comment
Share on other sites

If I'm correct, it happens on this line:rsUpdateEntry.Fields(Cstr(x.name)) = Request.Form(x.name)I'm not sure what the problem is, maybe you should ask Microsoft, since they're responsible for the helpful error message.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...