Recordset count problem

Results 1 to 2 of 2

Thread: Recordset count problem

  1. #1
    Join Date
    Dec 1969

    Default Recordset count problem

    Hi all,<BR><BR>I am having a problem getting an accurate record count from my rs. I keep getting -1 back. I checked the FAQ before posting and made sure I had a dynamic cursor. I can&#039;t seem to figure out what the problem could be. I am using ADO 2.5, connecting to the data source thru OLE-DB to an Access 2000 db (northwind sample provided by MS). Any help is greatly appreciated. My code is below.<BR><BR> dim objConn, objRec<BR> dim strSQL<BR> dim strConnect<BR> <BR> set objConn = server.CreateObject("ADODB.Connection")<BR> set objRec = server.CreateObject("ADODB.Recordset")<BR> strConnect<BR> strSQL= "select * from orders"<BR> objRec.CursorType = adOpenKeyset <BR> set objRec = objConn.Execute(strSQL)<BR><BR> response.write objRec.RecordCount & "&#060;p&#062;"<BR><BR> objRec.MoveFirst<BR> while not objRec.EOF <BR> response.write objRec("CustomerID") & "<BR>"<BR> objRec.MoveNext<BR> wend<BR><BR> objRec.Close<BR> set objRec = Nothing<BR> objConn.Close<BR> set objConn = Nothing<BR><BR>Justin

  2. #2
    J. Paul Schmidt Guest

    Default RE: Recordset count problem

    Perhaps check this out:<BR><BR>Cursor & LockType Performance Report - 6/27/1999<BR><BR>Test was done for inserting recs instead of just getting them.<BR>Use adOpenForwardOnly cursor (the default) whenever possible for speed, but use adOpenStatic if want to use objRS.MovePrev or objRS.RecordCount.<BR>Use adLockReadOnly lock type (the default) whenever possible for speed, but use adLockOptimistic when updating and deleting or adLockPessimistic if leaving a recordset open for editing which of course one shouldn&#039;t do on the Web anyway.<BR><BR>Best regards,<BR>-Paul<BR><BR>J. Paul Schmidt, MBA<BR>Databases on the Web<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