[thelist] ASP using SQL but anoing me like $%&#

Warden, Matt mwarden at odyssey-design.com
Sun Jan 28 16:57:31 CST 2001


print out your strsql, i'm pretty sure that's where the problem is. No
semicolon.

Or, try this:

objRS.Open strsql & ";"


--
mattwarden
mattwarden.com


----- Original Message -----
From: Elfur Logadottir <elfur at elfur.is>
To: <thelist at lists.evolt.org>
Sent: Sunday, January 28, 2001 4:24 PM
Subject: [thelist] ASP using SQL but anoing me like $%&#


> When I'm trying to display this page I always get the error:
>
> ###### THE ERROR #####
> Microsoft VBScript compilation (0x800A0401)
> Expected end of statement
> post.asp, line 27, column 17
> objRS.Open strsql;
> ######################
>
> but if I skip the semicolon I get this error instead
>
> ###### THE ERROR #####
> Missing semicolon (;) at end of SQL statement.
> post.asp, line 26
> ######################
>
> Where the hell, am I going wrong??
> If it does matter, I'm doing this on a private server
> running Windows2000 (IIS5)
>
>
> ######### THE PROBLEMATIC CODE #########
>
> <%@ Language=VBScript %>
> <%
> '## Define the dbConnection variables
> Dim objConn  'object Connection
> Dim objCmd 'object Command
> Dim objRS  'object RecordSet
>
> '## Connect to the Database
>  set objConn = server.CreateObject("ADODB.connection")
>  set objCmd = server.CreateObject("adodb.command")
>  set objRS = server.CreateObject("adodb.recordset")
>  objConn.Open "Provider=Microsoft.Jet.OLEDB.4.0; " & _
>      "Data Source= FULL SOURCE TO DB"
>  objCmd.ActiveConnection = objConn
>  objRS.ActiveConnection = objConn
>
> Dim strsql
> If Request.querystring("action") = "add" then
>  strsql = "insert into vinstri (name) values ('"&
> Request.form("nafn") &"')" & "(url) values ('"&
> Request.form("url") &"')" & "(menu) values ('"&
> Request.form("menu") &"')" & "(order) values ('"&
> Request.form("order") &"')"
> elseif REquest.querystring("action") = "edit" then
>  strsql = "update vinstri set name = '" &
> Request.form("nafn") & "' url = '" & Request.form("url") &
> "' menu = '" & Request.form("menu") & "' order = '" &
> Request.form("order") & "'  where id = " &
> REquest.querystring("id")
> else
>  Response.write "Houston, we've got a problem!"
>  Response.end
> End if
> objRS.Open strsql;    'it doesn't matter if I leave the
> semicolon out. - been there, done that.
> Response.redirect "vinstri.asp"
>
>  set objRS = nothing
>  set objRS2 = nothing
>  set objCmd = nothing
>  objConn.Close
>  set objConn = Nothing
>
> %>
>
> ######### ENDING PROBLEMATIC CODE #########






More information about the thelist mailing list