I have a table Employee having a column JoiningDate of type DateTime.
I am fetching this value in asp.net.
I know to check DBnull we use dr["JoiningDate"] != DBNull.Value .
But if this JoiningDate is empty like '', which fetching it is making it like 1/1/1900.
What is the best way to check DB EMPTY in asp.net for a datetime column.
Details :
JoiningDate is a DateTime field..I made it empty string in stead of NULL..
And while fetching this in asp.net in dr["JoiningDate"] which is a datarow, it gave 1/1/1900.
Code Example
DataSet dsEmployee = null;
dsEmployee = Data.Select("SELECT * FROM Employee WHERE EmployeeID = '" + _id + "'");
DataRow drEmployee = dsEmployee.Tables[0].Rows[0];
if(drEmployee["JoiningDate"] != string.Empty)
{
}
1/1/00011/1/1900, Can you show the select i guess somwething there is doing the transform or is it the default value for that column ?