CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Jun 2000
    Posts
    103

    ADO with SQL Server

    Hi,

    I am using SQL Server 2000 and I have a table with a date field created with the type datetime. Physically, the field is with the '/' separator. For example, 9/10/01 10:24:55AM. When I execute a Select statement in Query Analyzer, I find that it changes to '-' separation (09-10-2001 10:24:55AM). With ADO, the returned values is '/' separated. When I try to update the record with ADO, using the '/' separator, it is not allowing me to update the record. For example, when I execute the following query :
    Update TableId Set Field1 = '1' where Date = '09/10/01 10:24:55AM'

    it is not updating the record saying that the record is not found.

    Can anyone help me with resolving this issue.

    Thanks,
    Anitha


  2. #2
    Join Date
    Jan 2000
    Location
    Olen, Belgium
    Posts
    2,477

    Re: ADO with SQL Server

    This is one of those typical date issues. Your client computer has it local settings set to /, where sql has set it to -. When executing the update statement, SQL server gets a string, not a date. he will try to convert it to date, but fails, because it's settigns are different

    Tom Cannaerts
    [email protected]

    Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to produce bigger and better idiots. So far, the universe is winning -- Rich Cook
    Tom Cannaerts
    email: [email protected]
    www.tom.be (dutch site)

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

Featured