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!

database interaction web page 1

Status
Not open for further replies.

marct

Programmer
Apr 6, 1999
32
US
Hi!<br>
<br>
I need to make a page that will fill a listbox with the value of one field from selected records from a SQL server database, let the user choose one of the values from the listbox, then click a button and populate a table with the rest of the information in the chosen record (it's actually more complicated, but these are the fundamental operations I need help with). I am pretty good with VB and have made a web (ASP) page that populates (through VBScript) a table on the page with the contents of a SQL table in its entirety, but I don't know how to go both ways (i.e. choosing from list, user input). Could someone help me out, maybe point me in the right direction? Any help would be appreciated.<br>
<br>
Thanks in advance!<br>
<br>
-Marc
 
Here is a hint:<br>
the page category.asp uses Request.Forms("Name of select box").Value to find which one was selected<br>
<br>
good luck<br>
<br>
&lt;% <br>
Set DbObj = Server.CreateObject("ADODB.Connection")<br>
DbObj.Open "DSN=Music;USR=;PSW=;"<br>
SQL = "SELECT * FROM Categories"<br>
Set records = DbObj.Execute(SQL)<br>
records.MoveFirst<br>
%&gt;<br>
&lt;body bgcolor="wheat" onload="document.forms[0].reset()"&gt;<br>
&lt;form action="category.asp" Method="post"&gt;<br>
&lt;p&gt;Open Which Catergory?&lt;/p&gt;<br>
&lt;select name="cat" size="1"&gt;<br>
&lt;% WHILE NOT records.EOF %&gt;<br>
&lt;option value="&lt;%= records.Fields("CID").Value %&gt;"&gt;&lt;%= records.Fields("CategoryName").Value %&gt;&lt;/option&gt;<br>
&lt;% records.MoveNext %&gt;<br>
&lt;% WEND %&gt;<br>
&lt;/select&gt;<br>
&lt;br&gt;<br>
&lt;input type="submit" value="View Bands"&gt;&lt;input type="Reset"&gt;<br>
&lt;/form&gt;<br>
&lt;% <br>
DbObj.close<br>
SET DbObj = Nothing <br>
%&gt;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top