to make datetime nullable

  • Thread starter Thread starter Alex Liang
  • Start date Start date
A

Alex Liang

Dear all,

how can i pass an null or empty-value to datetime object?

I need to use a datatable to update an oracle table, and the datatable
contains a datacolumn, e.g. orderdate, which is of type datetime.

Any suggestion will be appreciated.

Alex
 
I suppose, the value of the command parameter can be set to DBNull.Value
(This is a more generic value)
Also, if you are using MS OracleClient provider, the parameter can be of
type OracleDateTime and the value can be OracleDateTime.Null
I am not too sure about Oracle's own Data provider (ODP)
 
Hi Alex,

Interesting question. I just tested it in sql server and a datetime can
definitely take a null. But if it isn't currently null, try xdate =
dbnull.value.

HTH,

Bernie Yaeger
 
Thanks for all the replies. The DBNull.Value is working but just needs so
many determination on whether the datetime equals to DBNull.Value.

regards,
 
Back
Top