SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member
    Join Date
    Feb 2012
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Unhappy very strange - text in variable gets changed

    I'm using Javascript to get the local workstation date and time. (User requirement.)

    I'm able to put it into a variable and/or a session variable looking like this:
    2012-02-23 05:52 PM

    Then I want to use it to update a nvarchar(50) SQL database column, but the column gets updated to this:
    --:

    Then I do some debugging and I see the update query is this:
    Update tblRecords set ws_DateTime = '2012-02-23 04:53 PM' where recordid = 12345

    If I run the update query in query analyzer, it properly updates the column to 2012-02-23 05:52 PM
    But if I let the update query run from the asp page, it improperly updates the column to --:
    If I hard-code the string into the update query, and let it run from the page, it works properly.
    But if I construct it on the fly in the page, it does not work properly.
    What is going on, and is there anything I can do? Hard-coding is not a solution I can use.

  2. #2
    SitePoint Guru
    Join Date
    Jun 2007
    Posts
    675
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    "But if I construct it on the fly in the page, it does not work properly."


    It appears the problem lies in how you construct it on the fly. Perhaps you could post that code so we can see what is going on.


Bookmarks

Posting Permissions

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