1.Use IsNull() function in your stored procedures.
Select Name, IsNull(Age, 18) From Members2.Use the following simple method
public DataTable RemoveDBNull(DataTable dt)
{
for (int i = 0; i < dt.Rows.Count; i++)
{
for (int j = 0; j < dt.Columns.Count; j++)
{
if (dt.Rows[i][j] == DBNull.Value)
dt.Rows[i][j] = 0;
}
}
return dt;
}
No comments:
Post a Comment