How to force null in date field - access 2007?
I开发者_JS百科 have a table that contains date field.
How can I force null
or empty
value on this field?
Thanks in advance
I had the same problem and solved it by this:
string DOB = "null" // this solved it , null should be a text and not a value
if(tb_date !="")
{ DOB = "#"+tb_date.text+"#" ;}
//and in the query:
insert into table(....,DateofBirth,...) values (.... "',"+DOB+",'"+...) ;
If you are referring to C# code, you can make the type nullable:
DateTime? dt = null;
Then acces it by:
if(dt == null)
dosomething;
else
myDT = dt.Value;
It is possible with ADO and a query, amongst other things:
UPDATE jobs SET atable.adate = Null
WHERE atable.ID=342
Just set DBValue.Null
whatever field you want to set Null
.
精彩评论