Home Search Contact us About us
Title Writing Date and Time to MS Access database
Summary The Visual Studio.NET wizard only allows dates to be written to a Date / Time column in MS Access. This is a work around.
Contributor John McTainsh
Published 30-Jan-2003
Last updated 30-Jan-2003
Page rating   54% for 10 votes Useless Brilliant

Introduction

When using the Visual Studio.NET IDE to create connections to MS Access databases, the default wrapper only puts Dates into Date/Time fields. This causes only the date to be saved and on the time when a date/time is written to the data set and Update is called.

How to fix it?

This is caused by the Wizard using DBDate rather than DBTimeStamp in the OleDbParameter method generated by the wizard. Ofcourse each time you regenerate this code using the wizard you will have to do the replace again.

Note: This has to be done in all OleDbParameter calls that use System.Data.OleDb.OleDbType.DBDate and replace with System.Data.OleDb.OleDbType.DBTimeStamp

Comments Date
sd 13-Sep-2004 luoweiliuz
sd
Solution 15-Sep-2004 tahir
Just change to System.Data.OleDb.OleDbType.Date and it will work.
Home Search Contact us About us