Results 1 to 8 of 8
  1. #1
    Join Date
    Dec 2002
    Posts
    4

    Unanswered: Wierd semicolon error with Mysql

    I have been having this problem with my mysql server. I get errors when I use the semicolon at the end of a sql command. I believe it is a server setting that is botched. Can anyone help?

    Error message:
    SQLState: 42000
    Native Error Code: 1064
    [TCX][MyODBC]You have an error in your SQL syntax near '; ' at line 1


    Code:
    "Select * from MessageboardTopics ;"


    If I remove the semicolon, the command works. If I insert a semicolon, the command fails.

  2. #2
    Join Date
    Feb 2002
    Posts
    2,232
    Where are you executing the sql statement ?

  3. #3
    Join Date
    Dec 2002
    Posts
    2

    Re: Wierd semicolon error with Mysql

    Originally posted by riznick
    I have been having this problem with my mysql server. I get errors when I use the semicolon at the end of a sql command. I believe it is a server setting that is botched. Can anyone help?

    Error message:
    SQLState: 42000
    Native Error Code: 1064
    [TCX][MyODBC]You have an error in your SQL syntax near '; ' at line 1


    Code:
    "Select * from MessageboardTopics ;"


    If I remove the semicolon, the command works. If I insert a semicolon, the command fails.
    If the select statement in question is being made using an API the semicolon is not required.

  4. #4
    Join Date
    Dec 2002
    Posts
    4
    Originally posted by rnealejr
    Where are you executing the sql statement ?
    Using Chilisoft ASP

    Without the semicolon, it runs fine.
    With the semicolon, I get an error.

    ----------

    SQL = "Select * from MessageboardTopics ;"

    set objStoreConn = Server.CreateObject("ADODB.Connection")
    objStoreConn.Open "DSN=xxx;UID=xxx;PWD=xxx"
    set rs = Server.CreateObject ("ADODB.Recordset")
    rs.Open SQL, objStoreConn

    if not rs.eof then
    while not rs.eof
    response.write rs(0)
    rs.movenext
    wend
    else
    response.write "No records exist"
    end if

    rs.Close
    set rs = Nothing

    objStoreConn.Close
    set objStoreConn = Nothing

  5. #5
    Join Date
    Feb 2002
    Posts
    2,232
    Just leave off the semicolon. This causes problems in so many development environments. Which platform are you using - ms or unix ?

  6. #6
    Join Date
    Dec 2002
    Posts
    4
    Leaving out the semicolon works for now, but I would like to find out why it doesnt like the semicolon. In the future, I may want to put multiple statements in one sql call. I would need to separate both the statements with something (?

    For the first month, the semicolon worked fine. Then one day, all my SQL calls got errors. I had to scrape through all the code to remove any semicolon in the code.

    Unix Platform

    Originally posted by rnealejr
    Just leave off the semicolon. This causes problems in so many development environments. Which platform are you using - ms or unix ?

  7. #7
    Join Date
    Feb 2002
    Posts
    2,232
    At the moment, you will not be able to handle multiple recordsets in unix using chilisoft -so having multiple sql statements may not be feasible. Have you tried to run multiple sql statements in chilisoft using a semicolon ?

  8. #8
    Join Date
    Dec 2002
    Posts
    4
    Rather than working around the semicolon, I would like to simply fix this problem. Why did all the scripts stop working one day? Why did I need to remove the semicolon?


    Now we are getting a little bit off topic but...

    I wish to get the autonumber of a recently added row. In doing so, I put the insert and select in the same query.

    If I did this call using two separate commands, there may be a problem. If two people insert at the same time, it is possible for both of them return the value of the same last inserted row. One of the people will have the incorrect value.

    I wish to do an insert, and then a select on the same command. Doing it this way ensures me that I will get the right number in a multuser environment.

    http://www.4guysfromrolla.com/webtec...122600-1.shtml



    Originally posted by rnealejr
    At the moment, you will not be able to handle multiple recordsets in unix using chilisoft -so having multiple sql statements may not be feasible. Have you tried to run multiple sql statements in chilisoft using a semicolon ?

Posting Permissions

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