hi,
I can insert a date time value that user choose from datepicker in table like below
5/2/2010
but i want to insert null if date hasn't been chosen.
so I write this code
DBase.ExecuteNoneQuery(System.Data.CommandType.Text, sql, new OleDbParameter[]{ new OleDbParameter("@child_age", JQDatePicker1.Date !=null ? JQDatePicker1.Date : DBNull.Value )
but it face with below error:
Type of conditional expression cannot be determined because there is no implicit conversion between 'System.DateTime?' and 'System.DBNull'
and when I convert dbnull.value like this
Convert.ToDateTime( DBNull.Value)
it throws below error
Object cannot be cast from DBNull to other types.
but I tried this one
new OleDbParameter("@child_age", DBNull.Value )
and it insert null in table
what's the solution?
one other thing I work with microsoft access not sql server
thanks a lot