Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to test if a DataSet is empty?

I'm modifying someone else's code where a query is performed using the following:

DataSet ds = new DataSet(); SqlDataAdapter da = new SqlDataAdapter(sqlString, sqlConn); da.Fill(ds); 

How can I tell if the DataSet is empty (i.e. no results were returned)?

like image 973
MCS Avatar asked Jun 04 '10 17:06

MCS


People also ask

What is an empty DataSet?

Empties a ProDataSet object of all records in its associated temp-tables.


1 Answers

If I understand correctly, this should work for you

if (ds.Tables[0].Rows.Count == 0) {     // } 
like image 194
rosscj2533 Avatar answered Sep 23 '22 22:09

rosscj2533