PDA

View Full Version : SQL statement help


ngoksel
10-20-2009, 12:23 AM
Hello all,

I want to execute a query from database, here the code,

Set Connection= Server.CreateObject("ADODB.Connection")
Set RecordSet= Server.CreateObject("ADODB.Recordset")

RecordSet.Open="SELECT * FROM logintable" , Connection
if Recordset.eof then
Response.Write("xxxxxxxx")
else.......

But there is a compilation error like folloving;

RecordSet.Open="SELECT * FROM logintable" , Connection
---------------------------------------^

I think there is an error in my SQL statement

Old Pedant
10-20-2009, 05:50 AM
No, you have a bogus equals sign there:

RecordSet.Open = "SELECT * FROM logintable" , Connection


Now try it WITHOUT the = sign:

RecordSet.Open "SELECT * FROM logintable" , Connection


Note that a VBScript compilation error COULD NOT come from an error in your SQL. It means, clearly, that you have a mistake in your fundamental VBScript syntax.