Solved

vb.net Dataset

Posted on 2004-08-24
2
331 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

829 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