-
Access and ADO.NET HELP!
I am attempting to send a Date to a Date/Time field within an MS access database, however the time keeps getting cut off and only the date appears. Why is this?
The Date/Time field is set to general date and the information i'm sending to the MS Acess through adding a record is a date with the same format (the standard return of the Now() function).
Any ideas? THanks in advance.
-
ahh!
No one knows anything about ADO.NET and Acess data relationships??? :eek: :rolleyes:
-
I do. CAn you show the code as when I write to access using an Insert statement it writes the full date and time as expected?
-
woohoo
Here is a simplified version of my code:
I am using the NewRow() function to create a new record within the data base.
Dim DTreceived As Date = Now()
Dim drNew As System.Data.DataRow
drNew = Me.dataAll.Tables(0).NewRow()
drNew.Item("dateReceived") = DTreceived
Me.dataAll.Tables(0).Rows.Add(drNew)
The data type for the field "dateReceived" in Access is set to Date/Time with the format "General Date"
When the record is inserted into the database, the date appears as just MM/dd/yy for some reason, no time...
-
Dim DTreceived As Date = Now()
^^^ wrong
Dim DTreceived As DateTime = Now()
^^^correct
-
I have already tried using DateTime, and just tried it again, same result...
Any ideas?
-
possible bug?
try this instead
drNew.Item("dateReceived") = System.DateTime.Now()
its the same thing but maybe there is a problem when putting now into a variable
:confused: :confused: :confused: :confused:
-
One problem here... i have to update two tables with the exact same time... so a variable is required....
I also tried that earlier.
Have you tried it?