Results 1 to 3 of 3

Thread: Net and MS-SQL handling of Date and Time

  1. #1

    Thread Starter
    Member
    Join Date
    Mar 2004
    Posts
    39

    Net and MS-SQL handling of Date and Time

    I am trying out using Net with MS-SQL and using the standard SQL connection. I am still not sure how DATETIME parameters are best handled when passing data to and from MS-SQL.

    From my intial test it seems that as long as I pass DateTIME date as parameter values MS-SQL will correctly interprete these without any special handling routines even if the Client and the Server have different regional settings.

    Can anybody guide on the best way to handle this.

  2. #2
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373
    when I wanted to save a date/time to my SQLServer from .NET, I simply formatted the value myself before the insert to the DB
    VB Code:
    1. Dim MyDate as Date
    2. Dim MyDateString as String
    3. MyDate = somedate, regional format doesnt matter
    4. MyDateString = MyDate.ToString.Format("mm/dd/yyyy hh:MM:ss AMPM")

  3. #3

    Thread Starter
    Member
    Join Date
    Mar 2004
    Posts
    39
    I did a test, my server is set to UK. I set my client PC to UK and updated a date field on the server. Changed the regional settings on the client PC to US and read back the date from the server and this was read without any problems.

    Do not know whether the SQL driver for net is doing all the work in the background. Wish to have somebody clarify this.

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