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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Access Parameter Query using ASP 1

Status
Not open for further replies.

sacsadmin

IS-IT--Management
Oct 16, 2002
39
US
This is a simple project really. I have a table that will be uploaded to a webserver once a week. The table simple contains two fields field one: bidnumber field two: lot number. I would like the client to enter in the bidnumber in a search box and query against the table and only output lot number matches for this. On the access side I have this all working correclty. I can query the database and get the appropriate output.

My hang-up being a very, very virgin web developer is, how do you pass a paramter query to actual database and have it return the correct info. I have ran some sample asp "hello world" tutorials, but do not seem to understand how asp treats a parameter query.

I know this is 101 stuff and it is probably somewhere written down, but I am under a time crunch and at the point that it is easier to ask then to learn.

Thanks in advance

 
if I understand the quetion right you jsut need to know how the user enters the value and then you pass that value to your query. right?

in order to pass a parameter to your query you need to use a form in order to submit the value.
then you can call that value with the requet method.
so if you have a form
<form name=&quot;frm&quot; method=&quot;get&quot; action=&quot;query.asp&quot;>
<input type=&quot;text&quot; name=&quot;pin&quot;>
<input type=&quot;submit&quot; value=&quot;search&quot;>
</form>

what happens here is the user enters the number and hits submit. in the method of the form I placed get so I can illistrate the way the querystring is sent. the action being query.asp is the apge that is going to do the processing and the actual query of the DB.
at this point the value is sent and the url will appear like this
page.asp?pin=12345
pin being your text field and 12345 being the value entered by the user

in your asp processing page (query.asp) you grab this value by the use of request.querystring. (due to the get method, if post method is used then request.form)
so
dim pin
pin = request.querystring(&quot;pin&quot;)
now you have the number and all you need to do is incorpurate it into your SQL query
sql = &quot;SELECT * FROM tblname WHERE bidnumber=&quot; & pin
this outputs
SELECT * FROM tblname WHERE bidnumber=12345


is that what you're looking for or am I way off. for the best results to your questions: FAQ333-2924
Is your question a most FAQ?? Find out here FAQ333-3048
 
Thanks onpnt.

This gives me a better understanding. I will when time permits RTFM, but time is of the essence right now.

By the way, I really like your tutorials on your website. Very clean and precise.







 
I'm sorry to say it... I never thougth it was possible.... But onpnt made an error !!! My world is collapsing LOL

... more seriously : I think you get confused between 2 ways to pass data to ASP pages.
--> Either you do it by a post and in this case the parameters are not shown in url and can't be retrieved in target page by a 'request.Querystring(&quot;pin&quot;)' but by a 'Request.Form(&quot;pin&quot;)'
--> Or you build the url by yourself (for example in a client-side function) adding the parameters you want to the page name with an &quot;?&quot; before first param and a &quot;&&quot; before following ones and in this case the parameters are shown in url and can be retrieved in target page by a 'request.Querystring(&quot;pin&quot;)'.

Water is not bad as long as it stays out human body ;-)
 
I haven't had a chance to key all of the tips into my problem at this time. His tip &quot;generally&quot; is giving me a better understanding of how ASP treats what I know as a parameter query in Access.

You are saying that you should retrieve the pin number from a Request.Form statement rather than a Request.Querystring?

Is there any advantage to building the URL from the client-side?

Really all I want is the person to be able to type in their PIN at a form click search and it either list the lots they have purchased or give them a message that they do not have any lots at this time. It needs to be flawless, fast, and transparent. Our user base is novice at best.

 
First option (&quot;request.form&quot; way) is better in this case because you don't have to code a single line in calling page to get your user entry on target page. Water is not bad as long as it stays out human body ;-)
 
ok targol you didn't have to make it that known [lol]
only when Tarwn makes errors we do that. [thumbsup2] _________________________________________________________
for the best results to your questions: FAQ333-2924
Is your question a most FAQ?? Find out here FAQ333-3048
 
Targol, onpnt does give the option of of the form method..
in his original explanation

Can you explain the difference between a request.Querystring vs. Request.Form Advantages / Disadvantages.

Also what is the difference between get method and post method. Advantages / Disadvangtees

Having options to do all this has me asking which is the best route to go.


Thanks again for your help.
 
main differnces in the two methods
GET (request.querystring)
1) restricted length in values passed
2) visible in the URL by the user
POST (request.form)
1) no length restrictions
2) secure as it is not visible and fully encrypted

it is far more likely to see the post method used then the get for most functions performed due to those main reasons and also recommeneded for those two reasons

_________________________________________________________
for the best results to your questions: FAQ333-2924
Is your question a most FAQ?? Find out here FAQ333-3048
 
OK, I seem to have everything working &quot;locally&quot; at this point. I have one additional question, I think it is relevent to this thread, if not I apologize.

How do I get asp to display a specific message in a seperate browser window if the resultiing query is &quot;empty&quot;.

Example: customer 899 did not have any lots in the database so I want to display a message in a seperate windows saying &quot;Sorry, you did not have any lots today&quot;.

As always thanks for your help.
 
Here is a kicker. I have some of what I want completed, so I thought I would test on my ISP. Guess what. They don't support ASP! *&^%%$!!!!

I am not a happy camper. today.
 
well, one good thing, knowledge is power and now you have a bit on asp. [smile] _________________________________________________________
for the best results to your questions: FAQ333-2924
Is your question a most FAQ?? Find out here FAQ333-3048
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top