Results 1 to 3 of 3

Thread: record number

  1. #1

    Thread Starter
    Member
    Join Date
    Aug 2002
    Posts
    53

    record number

    How can I get a record number from any table or query in SQL Server through ADO recordset, but CursorLocation in server side. There are some way to know it?

  2. #2
    Banned SCIROCCO's Avatar
    Join Date
    Jul 2004
    Location
    www.scirocco.ca
    Posts
    11
    Do you mean record count (total number of records) or the position of current record of your server-side cursor? Here is the answer to both:

    Code:
    'Record Count
    If rsSCIROCCO.Supports(adApproxPosition) Or rsSCIROCCO.Supports(adBookmark) Then
        RecordCount = rsSCIROCCO.RecordCount
    End If
    Code:
    'Current Position
    If rsSCIROCCO.Supports(adApproxPosition) Then
        AbsolutePosition = rsSCIROCCO.AbsolutePosition
    End If

  3. #3
    Fanatic Member Bombdrop's Avatar
    Join Date
    Apr 2001
    Location
    St Helens, England, UK
    Posts
    667
    If the recordset is forward only you can use the following to get a recordcount

    VB Code:
    1. Dim rs As New ADODB.Recordset
    2.       Dim vCount() As Variant
    3.       Dim lCount As Long
    4.  
    5.       rs.Open “SELECT * FROM Test”, “DSN=Test”, , ,           adCmdText
    6.       vCount() = rs.GetRows()
    7.       lCount = UBound(vCount, 2) + 1
    8.       Debug.Print lCount

    Hope this helps

Posting Permissions

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



Click Here to Expand Forum to Full Width