Modify query variable for Database lookup??

J

Julie

Hi, Everyone.

We have a page originally generated by FP's DRW
which we modified to our liking (all future changes will be
done in the page's code manually.) The user enters a value
into a field called XGINPUT.

What we'd like to do is strip superfluous characters a user
may type in prior to the lookup. For example:

Good input -> AB12345
Bad input -> AB-12345
Bad input -> AB-12,345

We have written a VB script that takes the value from Request.Form("XGINPUT")
and removes these characters, placing the 'cleaned' value into a variable called
XGCLEAN. But we don't know how to either:

a) place this XGCLEAN value into XGINPUT prior to the searching, or

b) modify the FP-generated command:
fp_sQry="SELECT * FROM tblX WHERE (XGR = '::XGINPUT::')"
so that it uses the new variable XGCLEAN instead of the form field XGINPUT.

Any suggestions?

Thanks.
 
M

Mark Fitzpatrick

All you have to do is concatenate the string with the inserted variable.
Example:

(XGR = '" & XGCLEAN & "')"

All we're basically doing is terminating the string after the first single
quote by using a doublequote, concatenating the variable to the string using
an ampersand &, then adding the tail end of the statement back on as a
string '). Essentially this is classic ASP that FP is creating. The only
exception is the :: that is before and after the name of a form field tells
the function to replace the ::XGINPUT:: with the value from the form field
(such as (XGR = '" & Request.QueryString("XGINPUT") & "')"

Hope this helps,
Mark Fitzpatrick
Microsoft MVP - FrontPage
 
J

Julie

Thanks Mark! It works a treat!

Your explanation was also very helpful and greatly increased
my understanding.

Thanks again.

Julie
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top