Click to See Complete Forum and Search --> : Syntax Probmlem in SQL script...


Rashar
04-08-2004, 11:30 AM
Hello,

My ASP code has a sql query string that i'm trying to return values, but i am getting the following error message...thanks in advance for all your help.


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

[Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in query expression '[QuizID]='.

/robert/aspquiz/VBQUIZ.asp, line 27


Here is the following script:



<%
'Dimension variables
Dim Conn 'Holds the Database Connection Object
Dim rs
Dim strSQL 'Holds the SQL query to query the database
Dim Quiz, QuizID

'Create an Conn connection object
Set Conn = Server.CreateObject("ADODB.Connection")

'Set an active connection to the Connection object using a DSN-less connection
Conn.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("VBQUIZ.mdb")


set RS = Conn.Execute("SELECT * FROM [quiz] WHERE [QuizID]=" & request.querystring("Quiz"))
%>

buntine
04-08-2004, 11:46 AM
Change your SQL query so it looks like this:

set rs = Conn.Execute("SELECT * FROM quiz WHERE QuizID = " & CInt(request.querystring("Quiz")))

Regards,
Andrew Buntine.

Rashar
04-08-2004, 12:26 PM
Well, I got passed that error, but i'm getting a BOF EOF is true etc... so I'm going to continue to look at how it loops....Thanks again though!

Best Regards,

Rashar

buntine
04-08-2004, 12:31 PM
No worries. Incase you dont already know, the EOF BOF error indicates that no records were extracted..

The following if statement will catch the error.

if rs.EOF and rs.BOF then
'statement sequence
end if

If you want further help, post your code and i will take a look.

Regards,
Andrew Buntine.