Avatar of contesa
contesaFlag for United States of America

asked on 

ASP Dynamic MEnu

I have a a telephone directory that is reading from an Oracle database. The table displays fine (so far my coding has worked)...I must tell you I'm a newbie at ASP.

Anyway, I want to be able to filter the table by section. Do I createa another recordset? Here's a sample of my code..

<%
Set OraDatabase = Server.CreateObject("ADODB.Connection")
OraDatabase.Open = "Provider=ORAOLEDB.Oracle;Data Source=test;User ID=test;Password=test;"
Set osRecordset = OraDatabase.Execute("SELECT EMPLOYEE, SECTION, LOCATION, PHONE_NUMBER phone from adm_test_phone_all")
Response.Write "<table border = 1 cellpadding = 4>"
Response.Write "<tr>"

For I = O to osRecordSet.Fields.Count - 1
      Response.Write "<td><b><center>" & osRecordSet(I).Name & "</center></b></td>"
Next

Response.Write "</tr>"

Do While Not osRecordSet.EOF
      Response.Write "<tr>"
      For I = O to osRecordSet.Fields.Count - 1
            Response.Write "<td>" & osRecordSet(I) & "</td>"
      Next
      Response.Write "</tr>"
      osRecordSet.MoveNext
Loop

Response.Write "</table>"

osRecordSet.Close
OraDatabase.Close
%>

I would appreciate any help/tips.  I am a user of Dreamweaver MX...I have tried using their tools but I can't get anything to dispaly within the list box.

Thanks.
Adobe Dreamweaver

Avatar of undefined
Last Comment
contesa
Avatar of painted
painted

Hi Contesa,
I'm not sure I  understand exactly what you are trying to accomplish.

A couple of things to begin:
You will need to add a WHERE clause to your SELECT statement.  
Set up a variable to hold the value you want to use in that clause

For example,
SELECT EMPLOYEE, SECTION, LOCATION, PHONE_NUMBER phone from adm_test_phone_all WHERE SECTION = myVariable.

You can set these up in DW using Recordset under the Application tab.

Can you post all of your code?

painted
Avatar of contesa
contesa
Flag of United States of America image

ASKER

Sorry...let me see if I can clarify what I'm looking for....so far I have the following script reading from a database. The "entire" directory displays in a table.

What I want is a list menu that a use can use to select a specific section...the table would regenerate and then display the names located within that section.  

For instance, when first displayed the table lists the following

Employee Name       Section       Location        Floor         Phone Number
John Doe                   ADM           TTN              8              666-6666

I want to be able to filter this table by section, making it easier to look for a name.  I would also like to add a search field, where the user could just enter part of  a name and search the directory. But I'm trying to accomplish one thing at a time.

Here is the entire code:

<%@LANGUAGE="VBSCRIPT"%>
<% Language=VBScript%>
<html>
<head>
<title>
Phone List Test
</title>
</head>

<body>

<%
Set OraDatabase = Server.CreateObject("ADODB.Connection")
OraDatabase.Open = "Provider=ORAOLEDB.Oracle;Data Source=test;User ID=test;Password=test;"
Set osRecordset = OraDatabase.Execute("SELECT EMPLOYEE, SECTION, LOCATION, PHONE_NUMBER phone from adm_test_phone_all")
Response.Write "<table border = 1 cellpadding = 4>"
Response.Write "<tr>"

For I = O to osRecordSet.Fields.Count - 1
      Response.Write "<td><b><center>" & osRecordSet(I).Name & "</center></b></td>"
Next

Response.Write "</tr>"

Do While Not osRecordSet.EOF
      Response.Write "<tr>"
      For I = O to osRecordSet.Fields.Count - 1
            Response.Write "<td>" & osRecordSet(I) & "</td>"
      Next
      Response.Write "</tr>"
      osRecordSet.MoveNext
Loop

Response.Write "</table>"

osRecordSet.Close
OraDatabase.Close
%>



</body>
</html>


ASKER CERTIFIED SOLUTION
Avatar of rockmansattic
rockmansattic

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of Fahdmurtaza
Fahdmurtaza
Flag of Pakistan image

Hi Contesa!
Well I think Rockmans thing would work perfect so what are you waiting for. I just bookmarked this open question in my ie and so its also of my interest.
Best of luck
Regards,
Fahd Murtaza
Avatar of contesa
contesa
Flag of United States of America image

ASKER

Hi Guys:

Sorry, I've been away on business....just getting back into the thick of things here..I will give this a try today and get back to you.

Thanks for all of your help.
Avatar of contesa
contesa
Flag of United States of America image

ASKER

Thanks Rock! I had to edit the code a bit, but it got me on the right track.......

Adobe Dreamweaver
Adobe Dreamweaver

Adobe Dreamweaver is a web development tool featuring both WYSIWYG and code editors that allow the user to quickly and easily build websites in a wide variety of languages, including ASP, ASP.NET, ColdFusion and PHP. It also offers support for CSS and JavaScript.

11K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo