Sorry guys, i am pretty new at asp so this is probably an easy to solve problem. I have the following code:

Dim customerID
customerID = Session("userID")
If customerID = "" Then
Response.Write ("Access denied")
Response.Write ("<a href=" & chr(34) & "age1.html" & chr(34) & ">Click here to login.</a>")
End If

'this query retrieves the order status, if you are using db1.mdb database
Dim SQL, pathTodb, db, dbId, rs, userid
asp_CustomerID = 3
' this customerID can be retrieved from the Session object, once the customer is logged in

'All this boring stuff of the database you already know....
pathToDb = "e:\isproot\yr0708\BN3369\Group-03\Copy of ast.mdb"
response.write("The database is at " & pathtodb & "<br>")
set db= Server.CreateObject("ADODB.Connection")
dbId = "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" &  pathToDb & ";UID=;PWD="
db.Open dbId
'And of the recordset as well.....
set rs = server.createObject("ADODB.Recordset")

'Define the query needed to find the required data:
'I've concatenated the SQL statement, just to look nice in Notepad++
SQL = "SELECT tbl_Order.Status FROM Customer.CustomerID, tbl_Order WHERE Customer.CustomerID = Session('userid')"
SQL = SQL & asp_CustomerID & "AND Customer.CustomerID = tbl_Order.CustomerID"

'Fill the recordset with the data defined by the query:rs.open SQL,db, 2,2
response.Write("We are now querying our database....<br>")
Response.Write ("<br>Dear Customer ...<br>")
Response.Write ("<br><br>This is the order Status at the moment...<br>")
Response.Write ("Status is: " & rs("Status") & "<br>")

'Close the recordset and the database
response.Write("Closing recordset..")
response.Write("Closing database..")


the error i get is the following

The database is at e:\isproot\yr0708\BN3369\Group-03\Copy of ast.mdb

Microsoft OLE DB Provider for ODBC Drivers error '80040e14'

[Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in query expression 'Customer.CustomerID = Session('userid')3AND Customer.CustomerID = tbl_Order.CustomerID'.

/isp/yr0708/BN3369/Group-03 /Myquery1.asp, line 73

line 73 will be the one in bold but i guess the problem is above that line. sorry for any inconvenience. thanks in advance

Edited by happygeek: fixed formatting

9 Years
Discussion Span
Last Post by hielo

Try this:

SQL = "SELECT tbl_Order.Status FROM tbl_Order WHERE Customer.CustomerID = " & Session('userid')
SQL = SQL & asp_CustomerID & " AND Customer.CustomerID = tbl_Order.CustomerID"
This article has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.