Results 1 to 8 of 8

Thread: Access and ADO.NET HELP!

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Jun 2002
    Posts
    16

    Angry 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.
    Last edited by USpatriot; Jul 26th, 2002 at 10:05 AM.

  2. #2

    Thread Starter
    Junior Member
    Join Date
    Jun 2002
    Posts
    16

    ahh!

    No one knows anything about ADO.NET and Acess data relationships???

  3. #3
    Banished Cander's Avatar
    Join Date
    Dec 2000
    Location
    Why do you care?
    Posts
    6,913
    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?
    Stack Overflow
    See the features of Visual Studio 2010 and C# 4.0: The 10-4 show on Channel9

  4. #4

    Thread Starter
    Junior Member
    Join Date
    Jun 2002
    Posts
    16

    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...

  5. #5
    Banished Cander's Avatar
    Join Date
    Dec 2000
    Location
    Why do you care?
    Posts
    6,913
    Dim DTreceived As Date = Now()

    ^^^ wrong

    Dim DTreceived As DateTime = Now()

    ^^^correct
    Stack Overflow
    See the features of Visual Studio 2010 and C# 4.0: The 10-4 show on Channel9

  6. #6

    Thread Starter
    Junior Member
    Join Date
    Jun 2002
    Posts
    16
    I have already tried using DateTime, and just tried it again, same result...
    Any ideas?

  7. #7
    Banished Cander's Avatar
    Join Date
    Dec 2000
    Location
    Why do you care?
    Posts
    6,913
    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

    Stack Overflow
    See the features of Visual Studio 2010 and C# 4.0: The 10-4 show on Channel9

  8. #8

    Thread Starter
    Junior Member
    Join Date
    Jun 2002
    Posts
    16
    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?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width