Solved

vb.net Dataset

Posted on 2004-08-24
2
330 Views
Last Modified: 2010-05-02
How can I know if my dataset has records?
0
Comment
Question by:Ilianam
2 Comments
 
LVL 85

Accepted Solution

by:
Mike Tomlinson earned 500 total points
ID: 11886063
I DataSet can have more than one table so you need to iterate the collection of tables and see if any have any rows in them like this:

    Private Function hasRecords(ByVal ds As DataSet) As Boolean
        If Not (ds Is Nothing) Then
            Dim dtCol As System.Data.DataTableCollection = ds.Tables
            If dtCol.Count > 0 Then
                Dim dt As DataTable
                For Each dt In dtCol
                    If dt.Rows.Count > 0 Then
                        Return True
                    End If
                Next
                Return False
            Else
                Return False
            End If
        Else
            Return False
        End If
    End Function

Regards,

Idle_Mind
0
 

Author Comment

by:Ilianam
ID: 11886182
Thank you .....It works...
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question