I am trying to input a date into an Oracle database. Sometime this value will be null. So in the function that I am writing I need a way to be able to pass in this null value. I am passing in this date as a parameter to stored proc. This parameter can be null. I am using the Oracle.DataAccess dll to get this thing to work. If it is indeed null, I am thinking of just throwing in a null variable. Do you think that would work??? Here is how I currently am setting up this scenario…
cmd.Parameters.Add("ACTIVE_DATEIn", DateTime.Parse(ActiveDate));
conn.Open();
outcome = cmd.ExecuteNonQuery();
Active Date is the possible null variable that I am going to pass in. Obviously you can’t Convert a null value into a date Time. What would you guys suggest doing?
Since
DateTimeis astruct, it cannot contain anullvalue.Some people use
DateTime.MinValueto store a null value. A better approach would perhaps be to makeActiveDateaDateTime?instead.Update:
You can also try something like: