CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Apr 2001
    Posts
    87

    Count record aside from Recordcount

    How can I have record count without using RecordCount function. Is there a way like

    Select Count(*) from Tablename

    If there is..how can I code this?
    starting with

    Dim RS As ADODB.Recordset

    Set RS = new ADODB.Recordset
    RS.Open ....


    cecile

    The more u read, the more u do not know

  2. #2
    Join Date
    Jan 2000
    Location
    Saskatchewan, Canada
    Posts
    595

    Re: Count record aside from Recordcount

    Dim RS As ADODB.Recordset

    Set RS = new ADODB.Recordset
    RS.Open "SELECT COUNT(*) as RecordCount FROM TableName",cnYourConnection, adOpenKeyset, adLockOptimistic, adCmdText
    debug.print RS!RecordCount
    rs.close
    set rs = nothing



    David Paulson


  3. #3
    Join Date
    Aug 2000
    Posts
    27

    Re: Count record aside from Recordcount

    If you want to use the "select count(*) from Tablename" method, just set a variable to the result like this:

    lngCount = RS.Fields(0)


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

Featured