Vimal
06-09-2003, 02:37 AM
Hi all,
I am getting some problems when I execute an sql query within different IF statements. However, when I remove the IF statements, my sql query is executed without any error. Can anyone help plz.
Here is my code:
sPath = Server.MapPath("reservedb.mdb")
strConn = "DRIVER=Microsoft Access Driver (*.mdb);DBQ=" & sPath
set conn = server.createobject("adodb.connection")
conn.open strConn
set connrcs = server.createobject("adodb.recordset")
If Request.form("D1") = Fiction Then
strSql = "select * from books where Fiction= ON"
End if
If Request.form("D1") = Romance Then
strSql = "select * from books where Romance= ON"
End if
If Request.form("D1") = Suspense Then
strSql = "select * from books where Suspense= ON"
End if
If Request.form("D1") = Autobiography Then
strSql = "select * from books where Autobiography= ON"
End if
Connrcs.CursorLocation = 3 'adUseClient
Connrcs.CursorType = 3 'adOpenStatic
Connrcs.ActiveConnection = Conn
Connrcs.Open strSQL
And here is the error that I get:
ADODB.Recordset error '800a0bb9'
The application is using arguments that are of the wrong type, are out of acceptable range, or are in conflict with one another.
/ereserve/result1.asp, line 66
I am getting some problems when I execute an sql query within different IF statements. However, when I remove the IF statements, my sql query is executed without any error. Can anyone help plz.
Here is my code:
sPath = Server.MapPath("reservedb.mdb")
strConn = "DRIVER=Microsoft Access Driver (*.mdb);DBQ=" & sPath
set conn = server.createobject("adodb.connection")
conn.open strConn
set connrcs = server.createobject("adodb.recordset")
If Request.form("D1") = Fiction Then
strSql = "select * from books where Fiction= ON"
End if
If Request.form("D1") = Romance Then
strSql = "select * from books where Romance= ON"
End if
If Request.form("D1") = Suspense Then
strSql = "select * from books where Suspense= ON"
End if
If Request.form("D1") = Autobiography Then
strSql = "select * from books where Autobiography= ON"
End if
Connrcs.CursorLocation = 3 'adUseClient
Connrcs.CursorType = 3 'adOpenStatic
Connrcs.ActiveConnection = Conn
Connrcs.Open strSQL
And here is the error that I get:
ADODB.Recordset error '800a0bb9'
The application is using arguments that are of the wrong type, are out of acceptable range, or are in conflict with one another.
/ereserve/result1.asp, line 66