Database retrieval - whats wrong??

Results 1 to 3 of 3

Thread: Database retrieval - whats wrong??

  1. #1
    sumedh Guest

    Default Database retrieval - whats wrong??

    i want to know the value assigned by the autonumber field in <BR>MS Access when i Insert a record into it....<BR><BR>isnt this possible??.... <BR>if &#039;conn&#039; is my connection and R is my recordset then:<BR><BR>dim temp<BR>Set R=conn.Execute("select id from &#060;table&#062;")<BR>R.MoveLast<BR>temp=R.Fields ("id")<BR><BR>This code gives an error: <BR><BR>Microsoft OLE DB Provider for ODBC Drivers error &#039;80040e24&#039; <BR>The rowset does not support fetching backwards <BR><BR>now what am i doing wrong??<BR>please advice....tks. in advance<BR><BR><BR> <BR><BR><BR> <BR>

  2. #2
    CousinIT Guest

    Default RE: Database retrieval - whats wrong??

    You need to specify how to open the recordset ie:<BR><BR>sqlQuery = "select id from &#060;table&#062;"<BR>Set R = Server.CreateObject("ADODB.Recordset")<BR>R.Cursor Type = adOpenDynamic<BR>Rs.LockType = adLockOptimistic<BR> <BR>R.Open SQLQuery, conn<BR><BR>I think the way your doing it is using the fire hose which is R.CursorType = adOpenForwardOnly<BR>

  3. #3
    Yngvar Guest

    Default RE: Database retrieval - whats wrong??

    You can try this<BR><BR>set r = Server.CreateObject("ADODB.RecordSet")<BR>With r<BR> .open "&#060;table&#062;", conn, adOpenDynamic, adLockPessimistic,adCmdTableDirect<BR> .Fields("yourfield") = yourvalue<BR> .Update<BR> temp = .fields("id")<BR> .Close<BR>End With<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