I have a table in which there are some datetime type columns. I use a stored procedure to insert values into the table. In the stored procedure I have variables that accept null
You can use this. There i no shortcut!!
if (InsertDate.Text == "") cmd.Parameters.AddWithValue("@enddate", DBNull.Value); else cmd.Parameters.AddWithValue("@enddate", Convert.ToDateTime(InsertDate.Text));