How do I check if row exists or not?
if( 0 == dtStock.Rows.Count ) // does not exist
You can use like this:
If(dtStock.Rows.Count > 0) // If dtStock.Rows.Count == 0 then there is no rows exists.
{
// Your Logic
}
See Here & Here. How to use Dataset
and DataTables.
You can use DataRowCollection.Count
property.
Gets the total number of DataRow objects in this collection.
If(0 == dtStock.Rows.Count)
Console.WriteLine("There are no rows in that datatable")