Results 1 to 3 of 3
  1. #1
    Join Date
    May 2004
    Posts
    144

    Unanswered: Error converting data type varchar to datetime

    hi
    i want to pass a datetime variable from a asp page to MSSQL through a stored procedure, & i get this error:
    Code:
    Microsoft OLE DB Provider for ODBC Drivers (0x80040E07)
    [Microsoft][ODBC SQL Server Driver][SQL Server]Error converting data type varchar to datetime.
    this is the code that i use in page:
    Code:
    strsql="sp_inventory @timee=' " & RecievedDate & " ' "
    also i use this one:
    but i still get this error
    Code:
    strsql="sp_inventory @timee=' " & cdate(RecievedDate) & " ' "
    this is maybe useful that i get this errot on some PCs, not all the computeres.
    sometimes work well, & sth not work.
    Last edited by bono56; 12-04-04 at 06:47.

  2. #2
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    try it without the blanks inside the single quotes
    Code:
    strsql="sp_inventory @timee='" & RecievedDate & "' "
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  3. #3
    Join Date
    Feb 2003
    Location
    Milano, Italy
    Posts
    80
    In addition pass the date in the ISO standard format:

    yyyymmdd

    Using this format SQL Server will also ignore regional settings, so that you can be sure that the date won't be misinterpreted
    Davide Mauri
    http://www.davidemauri.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
  •