|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
INSERT Statement with Empty DateI am using an Access database, VB.NET and ADO.NET working with a DataGrid control. MY datagrid table has both a date_sent and a date_ans field. When I Insert a record in my SQL statement, I insert a date_sent but I need to insert a blank date_ans field. date_sent is the date when a question was sent to a group from a web form and date_ans is the date when a question was answered. I need to have the datagrid initially show the date_ans field with a date shown and with the date_sent field having nothing shown. The date_ans field is later filled in with an UPDATE statement. I can put in a date into the date_ans field from my INSERT statement but it is confusing to the user and will be bogus information but a valid date is the only thing my query function, which passes the date_ans as a parameter, as being acceptable. I need to somehow find a way to have the app recognize a date as being a valid date which shows up as an empty value in the date_ans field. Thanks for any insight on this. On Sat, 8 Apr 2006 08:24:02 -0700, glenn <gl***@discussions.microsoft.com>
wrote: Show quote >Hi folks, You will have to set the date in the table to DBNull.Value when you insert it.> >I am using an Access database, VB.NET and ADO.NET working with a DataGrid >control. > >MY datagrid table has both a date_sent and a date_ans field. When I Insert >a record in my SQL statement, I insert a date_sent but I need to insert a >blank date_ans field. date_sent is the date when a question was sent to a >group from a web form and date_ans is the date when a question was answered. > >I need to have the datagrid initially show the date_ans field with a date >shown and with the date_sent field having nothing shown. The date_ans field >is later filled in with an UPDATE statement. > >I can put in a date into the date_ans field from my INSERT statement but it >is confusing to the user and will be bogus information but a valid date is >the only thing my query function, which passes the date_ans as a parameter, >as being acceptable. > >I need to somehow find a way to have the app recognize a date as being a >valid date which shows up as an empty value in the date_ans field. > >Thanks for any insight on this. However, when you display it you will have problems when reading it back from the database, because a DateTime object cannot be null in .NET 1.1. In .NET 2.0 you can set the DateTime object to a "nullable type". If you are using .NET 2.0 search for "nullable type" in the IDE help (Thank you MS for finally doing something about this issue). Good luck with your project, Otis Mukinfus http://www.arltex.com http://www.tomchilders.com |
|||||||||||||||||||||||