Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Request

Status
Not open for further replies.

MJCoxy

Programmer
Nov 22, 2001
16
0
0
US
Can anyone tell me what:
Code:
request("var")
actually does.
 
Also could anyone explain:
Code:
sQuery = "select * from phonebook where"
sQuery=sQuery & " (surname like '" & sTemp & "%' or surname like '" & ucase(sTemp) & "%') and"
What is the % for and also the ' ?
The other thing I'd like to know is what does
Code:
SQLSafe
actually do ?
 
Just gets any post data ie: main.asp?var=hello

szTmp = request("var")

szTmp now has hello, made need to ......CStr(Request("var")) gsc1ugs
"Cant see wood for tree's...!"
 
With regards to the sql question, the search values (in the above case, surname) need to be inside single quotes if they are a string value, hence placing a ' on either side of the variable. The % is a wildcard, so any combination of characters matches (use underscore for just a single character wildcard).

So in the above case, because you are appending the "%" onto the surname search value, if your sTemp value is Smith, then returned records could be Smith, Smithey, Smith-Kline etc because of the wildcard.
 
The LIKE pattern matching operator can also be used in the conditional selection of the where clause. Like is a very powerful operator that allows you to select only rows that are "like" what you specify. The percent sign "%" can be used as a wild card to match any possible character that might appear before or after the characters specified. For example:

select first, last, city
from empinfo
where first LIKE 'Er%';

in your query

sQuery = "select * from phonebook where"
sQuery=sQuery & " (surname like '" & sTemp & "%' or surname like '" & ucase(sTemp) & "%') and"

you are searching for surname with all possibilites of surname existing in uppercase,or with any wild characters

i hope this will help u

webspy
 
Thanks sweevo message understood.

But I still don't get what the request key word or function or whatever you want to call it does. Does it do anything at all or not ?
 
To summarise Request:

the ASP request object is used to retrieve a value from some source. The values can be from a form, a querystring, the server, cookies etc. Request simply "pulls" the respective value from wherever.

It is commonly used for form processing, where form data is sent via either GET (values sent in query string) or POST (values sent as form data). In the form, the ASP to process the data is specified, then when submitted the processing page can retrieve the passed values using the request object.

You can explicitly state where to get the value from e.g. request.form("value") or request.servervariables("server_name"), or you can just use request("value").

If you need help with a specific application of request, just post.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top