how to check null values from dataset?
if ((ds != null) && (ds.Tables.Count != 0) && (ds.Tables[0].Rows.Count != 0) && (ds.Tables[0].Rows!=null))
i got a dataset from excel file
dataset
1. hardik
2.Mahesh
3. null
4.null
5.rajesh
i want to find that 3rd and 4th rows from dataset
Loading
Suresh BabuPosted Aug 17, 2013, 7:13 AM
{
if(ds.tables[0].Rows[i]["columnname"].tostring()!=null)
{
}
else
{
}
}
Sanjeeb LenkaPosted Aug 17, 2013, 6:02 AM
DataTable dt = ds.Tables[0];
foreach (DataRow row in dt.Rows)
{
object value = row["ColumnName"];
if (value == DBNull.Value)
{
// do something
}
else
{
// do something else
}
}
pass the column name to search