Solved

vb.net Dataset

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

Ready to get started with anonymous questions?

It's easy! Check out this step-by-step guide for asking an anonymous question on Experts Exchange.

Question has a verified solution.

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

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
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…
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 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…
Suggested Courses
Course of the Month10 days, 9 hours left to enroll

628 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