Syntax Error in ASP?

Discussion in 'Microsoft Development' started by Bliss, Jul 28, 2003.

  1. Bliss Guppy

    I get this error, and I can't figure it out, since I didn't even know there could even be errors with this line of code. Any ideas? Microsoft VBScript compilation error '800a03ea'Syntax error http://www.ziggle.org/portal_docs/test/upd_user.asp, line 136 on error goto 0^
  2. StPatrick Guppy

    Can you post the code? Just few lines around line 136
  3. Bliss Guppy

    sub db_insert_edit_Users
    sql = "INSERT INTO Users" & _
    "(" & _
    "user_name," & _
    "password," & _
    ") VALUES (" & to_sql(user_name,"text") & "," & _
    "" & to_sql(password,"text") & "," & _
    ""

    on error goto 0
    cn.Execute(sql)
    if err.Number <> 0 then
    b_error = true
    error_list.add "db_insert_edit_Users" & err.Number ,"The database insert failed. " & err.Description
    else
    set rs = cn.Execute("SELECT @@IDENTITY")
    user_id = rs(0)
    rs.Close
    msg_list.add "db_insert_edit_Users","The database insert was successful." end if
    on error goto 0
    end sub

    It's from an appl that I got some time ago, so I didn't write it, but I see nothing wrong with the code. (But then, I'm not exactly proficient at ASP :p)
  4. StPatrick Guppy

    Are you sure this is the exact code that fails? It compiles fine on my machine. Though the first "On Error Goto 0" I'm sure should be "On Error Resume Next" (otherwise there is no point calling it).
    For the first time, try to comment/remove all "On Error..." in this function and let's see what we'll get, since the code looks ok and runs smooth both on my local computer and on JodoHost site.
  5. WineIsGood Guppy

    Get rid of the ON ERROR GOTO 0 crapola lines. Also, make sure to close the database connection at the end, even if there was an error. Use an If statement at the end to see if the connection is open, and if so, close it. That way it'll handle all cases... open or not.
    -Dave
  6. asheshb Guppy

    Hi,

    I think it is missing bracket causing the problem.Try this

    sql = "INSERT INTO Users(user_name,password) VALUES (" & to_sql(user_name, "text") & "," & to_sql(password, "text") & ")"

    Mainly after the "Values(" the bracket is not closed. Since the compiler could not find the end of the statement so ends up at On error go to 0
  7. StPatrick Guppy

    Good one, though this is not the case. But anyway the closing bracket was missing. It won't cause compiler error though, since it is just a string. As I mentioned, I was able to compile successfully and run (untill crashed on database :) ) the code without single change on both my machine and JodoHost.
  8. asheshb Guppy

    You are right about the string. It would have given error while executing and not compiling.Actually I am in bad habit of seeing things ahead :)

    So the only potential error left is

    msg_list.add "db_insert_edit_Users","The database insert was successful." end if

    Since "end if" is on the same line so compiler can not find the end of the If block
  9. StPatrick Guppy

    Ouch, you are right. As I remember, you have always add ":" between commands if you put them in same line, so this is the error... I probably formatted the code (as I always do) before checked it, that's why I've got no error :)
    But looks like Bliss already solved the problem, since he is not answering, lol
  10. Bliss Guppy

    Yeah, I solved the problem. It was very simple. I dumped this script and wrote my own. :))
  11. StPatrick Guppy

    Lol, I do usually the same :) And congrats on Lord :D

Share This Page

JodoHost - 26,000 hosting end-users in 100 countries
Plesk Web Hosting
VPS Hosting
H-Sphere Web Hosting
Other Services