First make sure that DataTable is not null and than check for the row count
if(dt!=null)
{
if(dt.Rows.Count>0)
{
//do your code
}
}
First make sure that DataTable is not null and than check for the row count
if(dt!=null)
{
if(dt.Rows.Count>0)
{
//do your code
}
}