Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - ASP/Access Data Retrieval
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

ASP/Access Data Retrieval

 Post Reply Post Reply
Author
Garrett1226 View Drop Down
Newbie
Newbie
Avatar

Joined: 09 January 2004
Location: United States
Status: Offline
Points: 11
Post Options Post Options   Thanks (0) Thanks(0)   Quote Garrett1226 Quote  Post ReplyReply Direct Link To This Post Topic: ASP/Access Data Retrieval
    Posted: 09 January 2004 at 1:38pm

I am fairly new to ASP and have just recently started projects to take advantage of its functionality.  I am creating a new web form with which my customers can enter their ZIP codes and from their response I have an ASP engine that queries an Access database for the results.

I have developed a good connection to the DB.  The table includes: ID (key) | NAME | Address | EMAIL.  How would I word the retrieval of the entire row of information?  How do I word the ZIP Code-To-key scripting?

Thanks for any help you can give.

Back to Top
Semikolon View Drop Down
Senior Member
Senior Member


Joined: 09 September 2003
Location: Norway
Status: Offline
Points: 1718
Post Options Post Options   Thanks (0) Thanks(0)   Quote Semikolon Quote  Post ReplyReply Direct Link To This Post Posted: 09 January 2004 at 1:48pm

you could try reading the database tutorials from bruce if you want to learn how to connect to a database and show/delete/update the data..

what do you mean with zip code-to-key?

Back to Top
Garrett1226 View Drop Down
Newbie
Newbie
Avatar

Joined: 09 January 2004
Location: United States
Status: Offline
Points: 11
Post Options Post Options   Thanks (0) Thanks(0)   Quote Garrett1226 Quote  Post ReplyReply Direct Link To This Post Posted: 09 January 2004 at 1:58pm

Sorry for the confusion:

I read the tutorials and that was how I figured out how to connect to the database.  From the tutorials, I learned how to return all the values in the Access database using the  DO WHILE - LOOP command.  I can do that fine, I have just not been able to find any literature explaining how to retrieve one row of information from a table.

To be more specific:  I have an HTML form that allows a user to enter their Zip Code.  That form posts to an ASP page.  I was going to use SELECT CASE statements to list all the possibilities for ZIP Code entries for my state. (have already used this method on another project and had good results). 

Using this setup, how can I reference "example" Zip Code: 65101 to automatically pull all the information from the row that has the key value of 2?  Within row 2 I have columns NAME | ADDRESS | FAX | EMAIL

Thanks for your quick response.

Back to Top
Semikolon View Drop Down
Senior Member
Senior Member


Joined: 09 September 2003
Location: Norway
Status: Offline
Points: 1718
Post Options Post Options   Thanks (0) Thanks(0)   Quote Semikolon Quote  Post ReplyReply Direct Link To This Post Posted: 09 January 2004 at 2:06pm

you should use the zip in the key, or you will have to create if/case lines for each zip..

 

to get only one row use this sql string

strSQL = "SELECT * FROM table WHERE ID = " & integersource

 

integersource is where you get the zip or whatever you want to use from.. for example Request.Form("ZIP") if you are using the POST method..

Back to Top
Garrett1226 View Drop Down
Newbie
Newbie
Avatar

Joined: 09 January 2004
Location: United States
Status: Offline
Points: 11
Post Options Post Options   Thanks (0) Thanks(0)   Quote Garrett1226 Quote  Post ReplyReply Direct Link To This Post Posted: 09 January 2004 at 4:32pm

Thanks for your help.  I ended up with the following to resolve all the queries:

Example:

Case 64422, 64430, 64447, 64469, 64474, 64490, 64494, 64497
 'Dekalb County
 
  strSQL = "SELECT * FROM CropAgents WHERE ID = 1"
  Set rsCropAgents = Server.CreateObject("ADODB.Recordset")
  rsCropAgents.Open strSQL, adoCon
  response.write("<left><br>")
  response.write("<b>" & rsCropAgents("NAME") & "</b>" & "<br>")
  response.write(rsCropAgents("ADDRESS") & "<br>")
  response.write(rsCropAgents("CITY") & "<br>")
  response.write(rsCropAgents("ZIP") & "<br>")
  response.write("Phone Number: " & rsCropAgents("PHONE") & "<br>")
  response.write("Fax Number: " & rsCropAgents("FAX") & "<br>")
  response.write("Email Address: " & rsCropAgents("EMAIL") & "<br>")

 

Thanks again for your quick responses.
Back to Top
Semikolon View Drop Down
Senior Member
Senior Member


Joined: 09 September 2003
Location: Norway
Status: Offline
Points: 1718
Post Options Post Options   Thanks (0) Thanks(0)   Quote Semikolon Quote  Post ReplyReply Direct Link To This Post Posted: 09 January 2004 at 5:16pm

that wasnt a request for help right?

but you should not use <left> and <br>.. thats not good xHTML..
use <div align="left"></div> and <br /> instead..
but this isnt really nessesary.. its just that in the future, the browsers may not understand it if youre not using xHTML by the rules.. so its recommended to start learning it at once..

Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.