Solved

vb.net Dataset

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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
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…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

758 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now