Results 1 to 5 of 5

Thread: row count in a dataset?

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2002
    Posts
    471

    row count in a dataset?

    I am new to vb.net.

    Now I am tring to query a set of related tables to get a record set, how can I get the record count in the result?

  2. #2
    Addicted Member
    Join Date
    Aug 2003
    Posts
    153
    If you want to know the number of rows in a dataset

    VB Code:
    1. Dim currentTable As DataTable
    2. Dim count As Integer = 0
    3.  
    4. For Each currentTable in myDataSet
    5.        count += currentTable.Rows.Count
    6. Next
    7.  
    8. 'count is the total number of rows in the dataset.

  3. #3
    PowerPoster
    Join Date
    Dec 2003
    Location
    Bristol, England (but heart is in Virginia)
    Posts
    2,949
    Hi,

    There is an easier way to use when you fill the dataset. Assuming the data adapter is da1; the data set is ds1 and the field "Name1"

    VB Code:
    1. Dim iCount as integer
    2. iCount=da1.fill(ds1, "Name1")


    iCount will then contain the number of records in ds1
    Taxes
    The more I learn about VB.NET the more I like dBaseIII Plus

    The foregoing, whilst believed to be correct, is given without guarantee as to it's accuracy and entirely without recourse. You are required to decide for yourself whether or not it is suitable for your purposes and no liability for loss of any nature can be entertained.

  4. #4
    Lively Member
    Join Date
    Mar 2006
    Posts
    70

    Re: row count in a dataset?

    hi Palm
    did u resolve u r query about record count after executing u r query statement.. please let me know

    thnks

  5. #5

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2002
    Posts
    471

    Re: row count in a dataset?

    Yes, I did by what taxes suggested. )) Thanks, Deepa.

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