Home

C# Check If DataTable Contains Data

Blog Date 9 June 2021

The Error

there is no row at position 0

The Code

if(MyDataTable.Rows.Count > 0)
{
   //do something with the data
}
else
{
   //there is no data
}

The Explanation

Errr... just check to see if there are any actual rows by counting them.


Full stack web development - contact ren@techsolus.co.uk

Reader's Comments

Post Your Comment Posts/Links Rules

Name

Comment

Add a RELEVANT link (not required)

Upload an image (not required)

No uploaded image
Real person number
Please enter the above number below




Home
Admin Ren's Biking Blog