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.
 
Back
Top