"OR" statement in Default line (Full Version)

All Forums >> [Web Development] >> ASP and Database



Message


Mav44 -> "OR" statement in Default line (6/2/2007 15:34:02)

Hi Guys & Gals,

Is it possible to use an "or" in a default line such as:

fp_sDefault="o_category=schools or daycare&bf_map=y"

I know I have written this wrong becuase I get nothing back. I think I made need to get rid of the spaces.

Thanks for your time and help in advance!




BeTheBall -> RE: "OR" statement in Default line (6/3/2007 13:29:48)

I would say no it is not possible. What the default does is assign a default value to the form field or querystring value you are searching on. Putting a default value with an or will just create one text string with an OR in it. For example, instead of returning records where the field "animal" is equal to "cat" or "dog", the database would be searched for animals that equal "cat or dog". Does that make sense?

You could use ASP to create alternative SQL strings. For example,

<%
if Trim(Request.Form("animal")) &"" = "" Then
mySQL = "SQL using a default string for the blank field"
else
mySQL = "Standard SQL using the form field value"
end if
%>

Does that make any sense?

Then, in your SQL you would use:

WHERE animal = &" myVar &"




Mav44 -> RE: "OR" statement in Default line (6/3/2007 23:04:45)

Thanks for the answer and suggestion!




BeTheBall -> RE: "OR" statement in Default line (6/4/2007 10:36:08)

No problem. The last two sentences in my previous post should be ignored. I changed my response and those two lines were left over from the first draft.




Page: [1]

Valid CSS!




Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI
0.046875