How to detect an empty DataSet

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

If I cal
dataAdapter.Fill(dataSet
and the dataSet contains no records because the query didn't match anythin
how can I tell if the DataSet is empty
The Tables.Count and Rows.Count are both 1
I'm using
if (dataSet.GetXml() != "<NewDataSet />"
which seems really flaky to me.
Tables.Count and Rows.Count both = 1 so thats no use
There must be a better way...what have I missed?
 
If there is 1 row in 1 table, then you query did return a result set, and
the data set is not empty. How can you say that getting back 1 row is the
same thing as an empty dataset?
 
Are you using Tables(0).Rows.Count?

You have to specify a table to count rows in. They start counting at 0 as
well.
 
Thanks all
Tables(0).Rows.Count returns 0
I not have been specifying the table, sorry.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top