Results 1 to 2 of 2

Thread: Problem inserting dates

  1. #1
    Paul Woods Guest

    Problem inserting dates

    I'm using ASP-db 6.UNO.11.26 on a Win2k/IIS5 server with a SQL2000 database also on Win2k, and I'm having a problem inserting dates.

    Using X.dbDebug = 101, I can see that ASP-db is trying to insert the record with the following statement:

    Edit SQL=INSERT INTO press_releases (Date) VALUES (#01/01/2001 00:00:00#)

    I get the following error:

    Error # (Edit_Execute_SQL) = 80040E14(-2147217900)
    Description = The name '#01' is not permitted in this context. Only constants, expressions, or variables allowed here. Column names are not permitted.
    Source = Microsoft OLE DB Provider for SQL Server
    SQL State = 42000
    Native Error = 128

    I get essentially the same error if I cut and paste the SQL into Query Analyzer and try it there.

    My X.dbSQL property is set to "SQL"

    I have tried setting X.dbOptions = "DateWrap='" but it seems to be getting ignored.

    I should note that doing this insert from a server running NT4/IIS4 and ASP-db 6.UNO.09.14 works fine. The date gets correctly wrapped with an apostrophe.

    Am I doing something wrong or is there a bug here?

    Thanks,

    Paul

  2. #2
    Paul Woods Guest

    Problem inserting dates (reply)

    Boy, do I feel stupid. I just realized that I specified the following:

    X.dbDBType = SQL

    It should be:

    X.dbDBType = "SQL" (with quotes)

    I also incorrectly referred to this property below as "X.dbSQL".

    When you use the correct syntax, everything works okay. Funny how that is.

    Time to go home! Good night!


    ------------
    Paul Woods at 12/27/00 5:32:10 PM

    I'm using ASP-db 6.UNO.11.26 on a Win2k/IIS5 server with a SQL2000 database also on Win2k, and I'm having a problem inserting dates.

    Using X.dbDebug = 101, I can see that ASP-db is trying to insert the record with the following statement:

    Edit SQL=INSERT INTO press_releases (Date) VALUES (#01/01/2001 00:00:00#)

    I get the following error:

    Error # (Edit_Execute_SQL) = 80040E14(-2147217900)
    Description = The name '#01' is not permitted in this context. Only constants, expressions, or variables allowed here. Column names are not permitted.
    Source = Microsoft OLE DB Provider for SQL Server
    SQL State = 42000
    Native Error = 128

    I get essentially the same error if I cut and paste the SQL into Query Analyzer and try it there.

    My X.dbSQL property is set to "SQL"

    I have tried setting X.dbOptions = "DateWrap='" but it seems to be getting ignored.

    I should note that doing this insert from a server running NT4/IIS4 and ASP-db 6.UNO.09.14 works fine. The date gets correctly wrapped with an apostrophe.

    Am I doing something wrong or is there a bug here?

    Thanks,

    Paul

Posting Permissions

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