Using % to show all results (Full Version)

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



Message


A1234 -> Using % to show all results (3/9/2005 8:41:44)

I forgot how to do this :( I want to give an option to "show all states" in the search options. I created a drop-down box with each state and then created one option to "show all states" with % as the value. However, it does not seem to be working. Apparently I missed a step in there somewhere. What do I need to get this to show all states? [&:]




Giomanach -> RE: Using % to show all results (3/9/2005 9:39:51)

Can you show us the ASP used to pull the records?




A1234 -> RE: Using % to show all results (3/9/2005 9:43:14)

Thanks for your help. Here is what I'm using.

<%
fp_sQry="SELECT * FROM Results WHERE (OriginState = '::OriginState::' OR DestinationState = '::DestinationState::')"
fp_sDefault="OriginState=Null&DestinationState=Null"
fp_sNoRecords="No records returned."
fp_sDataConn="postload"
fp_iMaxRecords=256
fp_iCommandType=1
fp_iPageSize=25
fp_fTableFormat=False
fp_fMenuFormat=False
fp_sMenuChoice="OriginState"
fp_sMenuValue="OriginState"
fp_sColTypes="&UserName=202&ID=3&LoadID=202&OriginState=202&OriginCity=202&DestinationState=202&DestinationCity=202&Miles=202&Rate=202&LoadDate=202&Equipment=202&ContactName=202&ContactPhone=202&Remote_computer_name=202&User_name=202&Browser_type=202&Timestamp=135&"
fp_iDisplayCols=10
fp_fCustomQuery=False
BOTID=0
fp_iRegion=BOTID
%>

Is this what you were referring to? [8|]




Giomanach -> RE: Using % to show all results (3/9/2005 9:45:45)

I was looking for that, and the form coding[;)]




A1234 -> RE: Using % to show all results (3/9/2005 9:56:05)

I haven't listed all the states in the drop-downs yet, just s few to do a test run...but here is the form code (there are two drop down search boxes)

<form BOTID="0" METHOD="POST" action="loads.asp">
<input type="hidden" name="fpdbr_0_PagingMove" value=" |< ">
<table BORDER="0">
<tr>
<td><b>Origin State</b></td>
<td><select size="1" name="OriginState">
<option value="Select State" selected>Select State
</option>
<option value="%">All States</option>
<option value="Alaska">Alaska</option>
<option value="Alabama">Alabama</option>
<option value="<%=Server.HtmlEncode(Request("OriginState"))%>"><%=Server.HtmlEncode(Request("OriginState"))%>
</option>
</select></td>
</tr>
<tr>
<td><b>Destination State</b></td>
<td><select size="1" name="DestinationState">
<option selected>Select State</option>
<option value="All States">All States</option>
<option value="Alaska">Alaska</option>
<option>Alabama</option>
<option value="<%=Server.HtmlEncode(Request("DestinationState"))%>"><%=Server.HtmlEncode(Request("DestinationState"))%>
</option>
</select></td>
</tr>
</table>
<br>
<input TYPE="Submit"><input TYPE="Reset"><!--webbot bot="SaveAsASP" clientside suggestedext="asp" preview=" " startspan --><!--webbot bot="SaveAsASP" endspan --></form>




Giomanach -> RE: Using % to show all results (3/9/2005 10:11:56)

The form:

<form BOTID="0" METHOD="POST" action="loads.asp">
<input type="hidden" name="fpdbr_0_PagingMove" value=" |< ">
<table BORDER="0">
<tr>
<td><b>Origin State</b></td>
<td><select size="1" name="OriginState">
<option value="Select State" selected>Select State</option>
<option value="">All States</option>
<option value="Alaska">Alaska</option>
<option value="Alabama">Alabama</option>
<option value="<%=Server.HtmlEncode(Request("OriginState"))%>"><%=Server.HtmlEncode(Request("OriginState"))%>
</option>
</select></td>
</tr>
<tr>
<td><b>Destination State</b></td>
<td><select size="1" name="DestinationState">
<option selected>Select State</option>
<option value="">All States</option>
<option value="Alaska">Alaska</option>
<option>Alabama</option>
<option value="<%=Server.HtmlEncode(Request("DestinationState"))%>"><%=Server.HtmlEncode(Request("DestinationState"))%>
</option>
</select></td>
</tr>
</table>
<br>
<input type="Submit"><input TYPE="Reset"><!--webbot bot="SaveAsASP" clientside suggestedext="asp" preview=" " startspan --><!--webbot bot="SaveAsASP" endspan --></form>


Form Process:
<%
'Pull Values From Frm
strDestination=Request.Form("DestinationState")
strOrigin=Request.Form("OriginState")

'Set Statement to allow for wildcards
if strDestination="" then
strDestination= "%"
End if

if strOrigin="" then
strOrigin = "%"
End if



'Use FP Recordset to set SQL Query, using LIKE for wildcards.
fp_sQry="SELECT * FROM Results WHERE (OriginState LIKE '" & strOrigin & "') OR (DestinationState LIKE '" & strDestination & "')"

fp_sDefault="OriginState=Null&DestinationState=Null"
fp_sNoRecords="No records returned."
fp_sDataConn="postload"
fp_iMaxRecords=256
fp_iCommandType=1
fp_iPageSize=25
fp_fTableFormat=False
fp_fMenuFormat=False
fp_sMenuChoice="OriginState"
fp_sMenuValue="OriginState"
fp_sColTypes="&UserName=202&ID=3&LoadID=202&OriginState=202&OriginCity=202&DestinationState=202&DestinationCity=202&Miles=202&Rate=202&LoadDate=202&Equipment=202&ContactName=202&ContactPhone=202&Remote_computer_name=202&User_name=202&Browser_type=202&Timestamp=135&"
fp_iDisplayCols=10
fp_fCustomQuery=False
BOTID=0
fp_iRegion=BOTID
%>


The bits I've altered are in bold

HTH




A1234 -> RE: Using % to show all results (3/9/2005 10:22:06)

Thanks! I got everything done, except the following (i'm not sure where to place this)

Form Process:
<%
'Pull Values From Frm
strDestination=Request.Form("DestinationState")
strOrigin=Request.Form("OriginState")

'Set Statement to allow for wildcards
if strDestination="" then
strDestination= "%"
End if

if strOrigin="" then
strOrigin = "%"
End if




Giomanach -> RE: Using % to show all results (3/9/2005 10:50:36)

Leave that where I have put it, it's to get the wildcards in action for you[;)]




A1234 -> RE: Using % to show all results (3/9/2005 11:13:24)

I replaced the code with the info that you provided but it still isn't showing all states :(
The page is located at www.nadras.com/loads.asp, if you want to have a look. There is one record in the database right now (alaska).

Thx again




Giomanach -> RE: Using % to show all results (3/9/2005 11:22:55)

fp_sQry="SELECT * FROM Results WHERE (OriginState LIKE '" & strOrigin & "') AND (DestinationState LIKE '" & strDestination & "')"

Replace that line with what I've given there




jmlbige -> RE: Using % to show all results (3/9/2005 12:44:12)

Try this... In your DRW click on "More Options" and the "Criteria". From there make sure you have Comparison set to "Contains"




A1234 -> RE: Using % to show all results (3/9/2005 12:54:04)

jmlbige, thanks very much! I knew it had to be something simple. My page is on the "spooky diet", so I edited the

DestinationState = '::DestinationState::

to

DestinationState LIKE '::DestinationState::

That did the trick!

Thank you to both of you [;)]




Page: [1]

Valid CSS!




Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI
0.078125