Error adding to a database

Results 1 to 5 of 5

Thread: Error adding to a database

  1. #1
    Shardool Karnik Guest

    Default Error adding to a database

    I am trying to add some data to a database. When the asp reaches the statement objRec.Update, I get the following error.<BR><BR>Microsoft OLE DB Provider for ODBC Drivers error &#039 80040e2f&#039 <BR>[Microsoft][ODBC Microsoft Access Driver]Error in row <BR>/fed/add.asp, line 166<BR><BR>What could be the problem ?<BR>I am able to connect and read from the database. But have a problem when adding to it.<BR>Even if I try modifying just one field such as the first name it still gives me the same error. Please help.<BR><BR>

  2. #2
    Neil Popham Guest

    Default RE: Error adding to a database

    I don&#039t actually KNOW the answer to this one, but I&#039m feeling a little free so I&#039ll hazard a guess.<BR><BR>The error message seems to point to the fact that there is, perhaps, no CURRENT record.<BR><BR>Is this possible?<BR><BR>You obviously have to open the recordset NOT read-only (ie: optimistic/pessamistic)... but I don&#039t think you&#039d get this error if that were the case.<BR><BR>Another one, seeing as I&#039m shooting in the dark, is perhaps this is the error returned if there is a conflict with an index within the database, or this somehow conflicts with some other rule set up in access.<BR><BR>If anyone would like to point me in the direction of a comprehensive list of ASP error codes then perhaps I may save myself this embarrassment...

  3. #3
    Join Date
    Dec 1969

    Default RE: Error adding to a database

    Happy Newyear<BR><BR>Can you display your code? I may help you if I could see your code.

  4. #4
    Shardool Karnik Guest

    Default RE: Error adding to a database

    Thanks guys but I always end up wasting a lot of time and end up figuring out the problem myself.<BR>I used the code kind of from the book. And it didn&#039t work. So, I tried something else and then it worked. But here is the code incase.<BR><BR>&#060;%<BR>Dim objRec<BR>Set objRec = Server.CreateObject("ADODB.Recordset")<BR>objRec.O pen "FEDTable", strConnect, adOpenStatic, adLockOptimistic, adCmdTable<BR><BR>objRec.AddNew<BR>&#039stuff to be added is here<BR>objRec.Update<BR><BR>objRec.MoveFirst &#039This is what I put and it works fine<BR>objRec.Find "Username = FName"<BR>If objRec.EOF Then<BR> Response.Write "Record Not Found"<BR>Else<BR> Response.Write "Successfully Added &#039New Name&#039<BR>"<BR> Response.Write "Website url is &#039" & objRec("Website") "&#039"<BR>End If<BR><BR>While Not objRec.EOF<BR> Response.Write objRec("First_Name") & ", "<BR> objRec.MoveNext<BR>Wend<BR><BR>objRec.Close<BR>Set objRec = Nothing<BR><BR>%&#062;<BR><BR>Well, I just discovered that it generates an error on objRec.Update. I will post some more details in while. BRB.

  5. #5
    Shardool Karnik Guest

    Default RE: Error adding to a database

    Ok. Actually help me on this please.<BR>I am using the similar code that I posted before. It doesn&#039t seem to work with an empty database. Do you know why ?<BR><BR>Thanks.

Posting Permissions

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