Trouble entering empty date into Access table from ASP.NET app using ADO.NET

J

josh

Hi,

I have an ASP.NET app that uses ADO.NET for data access. I have a form
that allows a user to enter a date. This date field is not required
however. If they don't enter it, I shove a variable declared of type
System.DateTime that is initialized to null into the database. It
works but if you open the table in Access, the date field contains
12:00 AM. When this value is rendered in an Access form, it shows as
12/30/1899.

What can I do to basically insert null/nothing into that field?

I'm using the System.Data.OleDb library and a parameterized query to
insert this date data into the Access table.

I tried checking for an empty date and substituted the date parameter
value with DBNull.Value but that doesn't seem to remedy the situation.

Thanks for the help,

Josh Blair
Evergreen, CO
 
J

joshblair

My bad. Setting the date parameter value to DBNull.Value did the
trick. Cool.

Josh Blair
Evergreen, CO
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top