Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27203

[RESOLVED] Test for empty dataset

$
0
0
I've been unable to figure out how to do this although it ought to be really simple. I'm using VB 2012.

Code:


Dim connection As SqlConnection = clsConnection.GetConnection()
Dim DataAdapter As SqlDataAdapter = New SqlDataAdapter(SQL, connection)
Dim Data As DataSet = New DataSet
DataAdapter.Fill(Data, Grid)

Grid.DataSource = Data

This is the basic reusable code which works fine. However, I need to test for an empty dataset (empty grid) at this point in the code and I can not seem to figure out how to do that. I've tried If (Data.Container is Nothing) then ... but that always is true. I'm not understanding something here ... could someone kindly set me on the right track?

TIA,
Ken

Viewing all articles
Browse latest Browse all 27203

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>