hello all
how to place DBNull value into a datetime field using c# code .
the field is already have a value .and I want to change it to DBNULL
tq
denny
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
paul danielPosted Mar 9, 2010, 3:01 AM
http://www.c-sharpcorner.com/UploadFile/sd_patel/EnterNullValuesForDateTime11222005015742AM/EnterNullValuesForDateTime.aspx
Hirendra SisodiyaPosted Mar 9, 2010, 3:41 AM
hello Denny
if you are using sql database then simply you can use this Query:
update temp_table set Date_field=NULL where Date_field is not Null
thank you
please chk answere if you like
Amit ChoudharyPosted Mar 9, 2010, 3:13 AM
Simply use following query syntax:
cmd.CommandText="update table1 set DateAdded="+DBNULL+" where DateAdded="+DateTime.Now;
Please mark as answer if it helps you.