Forums

This topic is locked

changing search from javascript to vbscript

Posted 02 Sep 2002 20:10:03
1
has voted
02 Sep 2002 20:10:03 Dave Clarke posted:
i have another problem with my conversion.

Here is the SQL i use in my search which works fine on the javascript site
<b>SELECT *
FROM Messages
WHERE YourFirstName LIKE '%MMColParam%' AND LastName LIKE '%MMColParam4%' AND WhoAreYouLookingFor LIKE '%MMColParam1%' AND Category LIKE 'MMColParam2' AND Message LIKE '%MMColParam3%' AND Category &lt;&gt; 'DELETED'
ORDER BY WhoAreYouLookingFor ASC</b>

I have copied this into my vbscript based site and it doesnt work, the search finds no results, dont get any errors just no results.

here are the parameters as set on the page
<b>Dim rsetSearchresults__MMColParam
rsetSearchresults__MMColParam = "zzzxxx"
if (Request.QueryString("finame" &lt;&gt; "" then rsetSearchresults__MMColParam = Request.QueryString("finame"
%&gt;
&lt;%
Dim rsetSearchresults__MMColParam1
rsetSearchresults__MMColParam1 = "zzzxxx"
if (Request.QueryString("look" &lt;&gt; "" then rsetSearchresults__MMColParam1 = Request.QueryString("look"
%&gt;
&lt;%
Dim rsetSearchresults__MMColParam2
rsetSearchresults__MMColParam2 = "zzzxxx"
if (Request.QueryString("scat" &lt;&gt; "" then rsetSearchresults__MMColParam2 = Request.QueryString("scat"
%&gt;
&lt;%
Dim rsetSearchresults__MMColParam3
rsetSearchresults__MMColParam3 = "zzzxxx"
if (Request.QueryString("smess" &lt;&gt; "" then rsetSearchresults__MMColParam3 = Request.QueryString("smess"
%&gt;
&lt;%
Dim rsetSearchresults__MMColParam4
rsetSearchresults__MMColParam4 = "zzzxxx"
if (Request.QueryString("laname" &lt;&gt; "" then rsetSearchresults__MMColParam4 = Request.QueryString("laname"</b>

one thing i should mention is that one of the form fields is a dropdown list of the various categories
i.e A value =A
B value=B
etc.
the first item in the dropdown list is All which i have given a value of % (wildcard) and this allows the search in all the categories rather than just one, i wonder if i should be using another wildcard but it works fine in javascript.

i have the default values of the search parameters set to zzzxxx because there is no possibility of this value occuring in the table

i hope i have made myself clear

thanks
Dave

Replies

Replied 02 Sep 2002 20:21:43
02 Sep 2002 20:21:43 Dave Clarke replied:
btw the last bit of the url when i submit the form is

searchres.asp?finame=david&laname=&look=&scat=%25&smess=&Submit=Search

looks ok to me
Replied 02 Sep 2002 22:57:00
02 Sep 2002 22:57:00 Dave Clarke replied:
sorted it

apparently the way the default values are treated in javascript and vbscript differ, in javascript they had to be something that wouldn't be found by the search i.e 'zzzxxx' but in vbscript they have to be something that will be found so i've changed them to '%' (wildcard) and now the search seems to work ok. (apart from the old multiple words have to be in correct order, but i wont go into that again<img src=../images/dmxzone/forum/icon_smile_wink.gif border=0 align=middle>

Dave

Reply to this topic