coolskater49
Technical User
I have a a series of ASP web pages that connect to an Oracle database and retrieve data / perform queries.
On one page the user enters the query data, then clicks submit, and the ASP queries the DB and displays the results. Currently i have this set-up working for when the user is only presented with one box to enter a query value into.
This is the code i am using and it works -
I now want to give the user three boxes to enter query data into, where the user may enter into any 1, 2 or ALL of the boxes.
I am attempting to do this using an IF statement like this -
IF box1 is null AND box2 is null THEN
execute this sql statement
ELSE IF box3 is null AND box2 is null THEN
execute this sql statement
ELSE IF box3 is null AND box1 is null THEN
execute this sql statement
....
....etc so in the end i will have 7 different sql statements capable of execution.
This is my actual code below, and it doesnt work.
Could anyone please help?
Cheers, sorry for the long post.
On one page the user enters the query data, then clicks submit, and the ASP queries the DB and displays the results. Currently i have this set-up working for when the user is only presented with one box to enter a query value into.
This is the code i am using and it works -
<%
....
....
If BRANCHS_ID<>"" Then
Response.Write("The Branch ID requested is: " & BRANCHS_ID & " <br />")
Set objConnection = Server.CreateObject("ADODB.Connection")
With objConnection
.ConnectionString = "Provider=MSDAORA.1;Password=*****;User ID=******;Data Source=stora;Persist Security Info=True"
.Open
sql=(SQL STATEMENT)
Set objRecordset = .Execute(sql) %>
I now want to give the user three boxes to enter query data into, where the user may enter into any 1, 2 or ALL of the boxes.
I am attempting to do this using an IF statement like this -
IF box1 is null AND box2 is null THEN
execute this sql statement
ELSE IF box3 is null AND box2 is null THEN
execute this sql statement
ELSE IF box3 is null AND box1 is null THEN
execute this sql statement
....
....etc so in the end i will have 7 different sql statements capable of execution.
This is my actual code below, and it doesnt work.
Could anyone please help?
Cheers, sorry for the long post.
If AGE="" AND YR="" Then
Response.Write("The Category requested is: " & CAT & "<br />")
Set objConnection = Server.CreateObject("ADODB.Connection")
With objConnection
.ConnectionString = "Provider=MSDAORA.1;Password=******;User ID=*****;Data Source=stora;Persist Security Info=True"
.Open
sql(SQL STATEMENT)
Set objRecordset = .Execute(sql)
Else If CAT="" AND YR="" Then
Response.Write("The Age Restriction requested is: " & AGE & "<br />")
Set objConnection = Server.CreateObject("ADODB.Connection")
With objConnection
.ConnectionString = "Provider=MSDAORA.1;Password=******;User ID=******;Data Source=stora;Persist Security Info=True"
.Open
sql=(SQL STATEMENT)
Set objRecordset = .Execute(sql)
Else If CAT="" AND AGE="" Then
Response.Write("The Year requested is: " & YR & "<br />")
Set objConnection = Server.CreateObject("ADODB.Connection")
With objConnection
.ConnectionString = "Provider=MSDAORA.1;Password=******;User ID=******;Data Source=stora;Persist Security Info=True"
.Open
sql=(SQL STATEMENT)
Set objRecordset = .Execute(sql)
....
....
End If