[thelist] ASP using SQL but anoing me like $%&#
Elfur Logadottir
elfur at elfur.is
Sun Jan 28 16:51:34 CST 2001
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 #########
thanks a bunch
[elfur]
More information about the thelist
mailing list