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

Lookups ASP / SQL

Status
Not open for further replies.

david7777777777

Programmer
Sep 26, 2001
417
US
I've used Access look-up (Lookup Wizard) when creating a table before in order to display information from another table. How do you do this sort of thing with SQL? Just point me in the right direction (tutorial, online articles, etc.), I'm not looking for any handouts. I want to learn and understnad how this works.

I'm using Visual InterDev to build ASP pages to work with a with a SQL backend. I want our IT team to be able to use web pages (ASP pages) to add, edit, delete, and search for records in the SQL database. I'm using it for inventory tracking, among other things. Here's one thing I'm trying to accomplish:

I made a table to hold user name, amount of RAM, serial number, manufacturer, model, and many other fields for our desktop computers. When someone opens this table to ad a new record, I'd like to make the manufacturer field to "lookup" records from another table I made called "desktop_manufacturers." I'm trying to minimize the amount of manual data entry our team will do. Therefore I've made several tables to hold information that will be used in other tables, or maybe queries. Am I using the wrong terminology? I'm tired of running into useless descriptions in Microsoft's documentation. Can you help get me started on this?
Thanks,
David
 
It sounds like all you want to do is execute an SQL "select" statement against your database and populate a listbox with the manufacturer's names from the resulting recordset, then save the name chosen by the user along with the other form data.

For ASP, you'll need to know ActiveX Data Objects (ADO) in order to connect to and open the database, as well as to execute a query on the data.

Let's say your table has a "name" field. The SQL would look something like:

SELECT name FROM desktop_manufacturers

That will return a recordset comprising of a single field (name), that you could then walk through using a do...loop and populate the listbox with each name.

"VB Oracle 8 Programmer's Reference" from Wrox is an excellent reference for both ADO and SQL, even if you're not using Oracle.
 
If you try to use DTC's in Visual Interdev, you may get near the level of productivity that you achived with Access. SQLServer does not have Lookup column attributes (i.e. in the Enterprise Manager), however you could 'link' Access to SQLServer tables via ODBC to achieve this.

The DTC's, via the Data Environment, make adding drop-down lists quite easy, as well as Table views (like Access 'Continuous Forms') and Single Row Display forms.

However, DTC's take a little getting used to - so I suggest you grab a training course if you can. There are not many good books on the subject either (well I've not seen one).

You could then discover how to create an editable 'grid' (see the FAQ section), how to navigate between pages (use the 'PageObject'), how to update the recordset etc..

good luck. (Content Management)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top