Strange objRS Update Behaviour

Results 1 to 3 of 3

Thread: Strange objRS Update Behaviour

  1. #1
    Troy the ASP Boy Guest

    Default Strange objRS Update Behaviour

    Thanks in advance for your help!<BR><BR>I am developing a site using ASP and Access97 with an OBDC DSN.<BR><BR>The site allows users to log on using a username and password combination. I have no problems allowing the users to log in. The site always finds the correct username/password combination.<BR><BR>This is a directory site and once logged on, there is a image that links to the edit_company_profile.asp page that passes the username and id(access autonumber). The form information is always found. At the bottom of the form there is a submit button which submits the info to the same page with an action variable=update.<BR><BR>This is where things get ugly!<BR><BR>Sometimes the code works and sometimes it gives me the following error:<BR><BR><BR>Microsoft OLE DB Provider for ODBC Drivers error &#039 80004005&#039 <BR><BR>Query based update failed. The row to update could not be found. <BR><BR>/includes/update_company_info.asp, line 119 <BR><BR>It&#039s weird because it seems to be working in a random fashion. I have no idea where to start! Please help!<BR><BR><BR>MY ASP CODE FOLLOWS:<BR><BR>Dim djid<BR>djid = CInt(Request.Form("djidnumber"))<BR>Set objConn = Server.CreateObject("ADODB.Connection")<BR>strConn ection = "DSN=djdb;Database=djdb;UID=sa;PWD=;"<BR>objConn.O pen strConnection<BR>Set objRS = Server.CreateObject("ADODB.Recordset")<BR>objRS.Cu rsorLocation = adUseServer<BR>objRS.CursorType = adOpenForwardOnly<BR>objRS.LockType = adLockOptimistic<BR>strQuery = "SELECT * FROM djinfodb WHERE djidnumber="<BR>strQuery = strQuery & djid<BR>objRS.Open strQuery, objConn, , , adCmdText<BR>INSERT objRS("variable")=Request.Form("variable") CODE HERE<BR>objRS.Update

  2. #2
    Leungas Guest

    Default RE: Strange objRS Update Behaviour

    Try to run the same query in access with the same parameters you pass into the query. Maybe the rs did not return any records at all...

  3. #3
    Troy the ASP Boy Guest

    Default RE: Strange objRS Update Behaviour

    I could not figure out how to fix the problem. It appeared in a completely random function. After a little bit of research i used the following code:<BR> objRS.CursorType = adOpenStatic<BR>instead of <BR> objRS.CursorType = adOpenForwardOnly<BR>and the problem seemed to be fixed.<BR><BR>cheers<BR>troy the asp boy<BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts