Solved

vb.net Dataset

Posted on 2004-08-24
2
333 Views
Last Modified: 2010-05-02
How can I know if my dataset has records?
0
Comment
Question by:Ilianam
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 86

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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

759 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