static recordset

Results 1 to 2 of 2

Thread: static recordset

  1. #1
    Join Date
    Dec 1969

    Default static recordset

    I want to use .recordcount to get the number of records in my recordset. In my code recordcount returns 0, but when I run the query in SQL*plus, I have over 100 results. I just discovered cursors today so take a look and see if I have a newbie mistake:<BR><BR>Dim RSstat<BR>Set RSstat = Server.CreateObject("ADODB.Recordset")<BR>RSstat.O pen strSQL, cn, adOpenStatic<BR>Response.write(RSstat.recordcount) <BR><BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: static recordset

    Is that code returning an error? It&#039;s incomplete so it&#039;s hard to say if it is correct or not. If you are trying to open a dynamic recordset that is navigable, and will return an accurate recordcount, you need to open the recordset with a dynamic cursor and lock type. I normally use <BR><BR>RSstat.Open strSQL, cn, 2, 3 <BR><BR>The 2 is the enum value for adOpenDynamic CursorTypeEnum and 3 is the enum value for adLockOptimistic LockTypeEnum. I prefer to use the actual values instead of declaring the variables, but that&#039;s just my weird self.

Posting Permissions

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