ASP.NET version of "If rs.eof then" or "If not rs.

Tutflutle

New Member
Most of my coding involves checking one table for a field, and if it exists, then updating or adding or deleting a record from another table.<BR>AS IN<BR><BR>if rs.eof then<BR>do something<BR>end if<BR><BR>I have yet to find such code for asp.net<BR><BR>Anybody know how handle it?What are you using to get the data back? A SqlDataReader or OleDbDataReader, or a DataSet? If you are using a DataReader variant, you can do:<BR><BR>if (!myDataReader.Read())<BR> // no records<BR>else<BR> // records<BR><BR>if you are using a DataSet:<BR><BR>if (myDataSet.Tables[0].Rows.Count == 0)<BR> // no records<BR>else<BR> // records<BR><BR>hth
 
Back
Top