Error with SQL
- From: J-P-W <jonpwebb@xxxxxxxxx>
- Date: Tue, 19 Jun 2007 16:00:31 -0700
Hi,
I have:
strsql = "SELECT * FROM tblTheCustomers WHERE CustomerID=" &
session("CustomerID") & ";"
response.Write(strsql)
Response.End()
The browser shows:
SELECT * FROM tblTheCustomers WHERE CustomerID=1;
Great!
When I remove the two response. 's I get:
Error Type:
Microsoft JET Database Engine (0x80040E14)
Syntax error in WHERE clause.
C.asp, line 62
The whole code is below, any ideas? Thanks
Jon
----------------------------------------------------------------------------------
Code:
dim conn, strsql, rsuser, strMDBPath
set conn=server.createobject("ADODB.Connection")
set rsuser=server.createobject("ADODB.Recordset")
strMDBpath = Server.MapPath("Files.mdb")
conn.open "PROVIDER=MICROSOFT.JET.OLEDB.4.0;DATA SOURCE=" & strMDBPath
strsql = "SELECT * FROM tblTheCustomers WHERE CustomerID=" &
session("CustomerID") & ";"
'response.Write(strsql)
'Response.End()
rsuser.open strsql,conn,1,2
CustomerName = rsuser("CustomerName")
CustomerLogo = rsuser("CustomerLogo")
rsuser.close
set rsuser=nothing
----------------------------------------------------------------------------------
.
- Follow-Ups:
- Re: Error with SQL
- From: Bob Barrows [MVP]
- Re: Error with SQL
- From: J-P-W
- Re: Error with SQL
- Prev by Date: Working with Sessions for functions
- Next by Date: Re: Error with SQL
- Previous by thread: Working with Sessions for functions
- Next by thread: Re: Error with SQL
- Index(es):
Relevant Pages
|