cmd1.Parameters.Add("@emp_name1", SqlDbType.NVarChar);
cmd1.Parameters.Add("@join_date1", SqlDbType.DateTime);
cmd1.Parameters["@emp_name1"].Value = name.Text;
System.Data.SqlTypes.SqlDateTime getDate;
//set DateTime null
getDate = SqlDateTime.Null;
if (joindate.Text == "")
{
cmd1.Parameters["@join_date1"].Value = getDate;
}
else
{
cmd1.Parameters["@join_date1"].Value = joindate.Text;
}
I used this code to insert a null value in datetime column of sql server table
but always its giving the error
string is not recognized as a valid datetime
Please help me.
Thanks in Advance.