Update Query works in Query Analyzer, but not from ASP page

  • I am doing some "Classic ASP" development. I have a problem I have never seen before. I am building up a SQL string to do an update. Once it is built, if I paste it into Query Analyzer, it works perfectly. Here is the string from the response.write I put in the asp page to debug it and run it in QA:

    update myTable set q1=1, q2=2, q3=2, q4=2, q5=1, q6=2, q7=2, q8=1, q9=1, q10=2, q11=3, q12='Help me' where RecordNo=23

    When I execute this from the asp page, I get the following error:

    Error Type:

    Microsoft OLE DB Provider for SQL Server (0x80040E14)

    Line 2: Incorrect syntax near '<'.
    /go2.asp, line 28

    I have tried this with the OLEDB driver above, and the ODBC driver, same error with both. BTW, Line 28 in my asp is the line that does the execute of the sql string.

    I am not sure where to turn at this point. The db code in my page is quite simple and I have used it in numerous locations without problem. Just FYI, I cut down the above statement to just do an update set q1=1 (a tinyint) where RecordNo = 23, and the result is the same. Tried doing a select here instead - no problem. If anyone has any ideas, I would sure appreciate it, I have wasted hours on this.

    Thanks,

    Peter

  • Check if you have UPDATE permission on myTable. I cannot think of anything else.

  • Write you statement as store procedure and pass parameters with asp. If it still not works, you have probably a permission problem.

    If it works review your code one again. The error ist strange but it point to a syntax error in my opinion.

  • I have tracked this down to an asp problem, not a SQL Server problem. There is something strange happening to my recordno as it gets passed to subsequent pages and used in updates, so I have to figure out what is going on with that. Thanks to everyone for their help.

    Cheers,

    Peter

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply