472,340 Members | 1,805 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,340 software developers and data experts.

two dropdown list getting data from access table

i am using java inside java script page.
in that page i want to use two dropdown list.
in first dropdown list i am getting data from ms-access database.
in second dropdown list i want to get data according to selection made in first dropdown list and it will also come from ms-access database.(for example if i am selecting country as india in first dropdown list then in second dropdown list will show states of india)

the problem is that i am not able to get the proper result in second dropdown list
i will be thankful if you give me proper solution to my problem
Mar 24 '08 #1
5 6533
r035198x
13,262 8TB
i am using java inside java script page.
in that page i want to use two dropdown list.
in first dropdown list i am getting data from ms-access database.
in second dropdown list i want to get data according to selection made in first dropdown list and it will also come from ms-access database.(for example if i am selecting country as india in first dropdown list then in second dropdown list will show states of india)

the problem is that i am not able to get the proper result in second dropdown list
i will be thankful if you give me proper solution to my problem
Why don't you post the code that you have and explain explain the results you want to get.
Mar 25 '08 #2
Why don't you post the code that you have and explain explain the results you want to get.

the first dropdown list is for displaying project name and second dropdown list is for displaying approver name associated with selected project name in first dropdown list.
the problem is in second dropdown list the required data is not comming

<!-- project Name drop-down list -->


<tr>
<td><b><font color=blue>Project Name</font></b></td>

<% String CategoryCombo = null;%>

<td><SELECT NAME="pname" id= pname tabindex=5 onchange=location.href='pic_demo.jsp?option'=+this .value;>
<%
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver").newI nstance();
Connection conn = DriverManager.getConnection("jdbc:odbc:Cab");
Statement statement = conn.createStatement();
ResultSet rs = statement.executeQuery("select projname from login where desgn<>'A' group by projname");%>
<OPTION VALUE=0>Choose Project Name</OPTION>";
<%
while(rs.next())
{
CategoryCombo = rs.getString("projname");%>
<option value='<%=CategoryCombo%>' /><%out.println(CategoryCombo);%></option>
<% } %>

</SELECT></td>
</tr>


<!--- This is for approver dropdownlist --->

<tr>
<td><b><font color=blue>Approver</font></b></td>

<%
String ApproverCombo = null;%>
<td><SELECT NAME="Approver" id =Approver tabindex=6>
<OPTION VALUE=0>Choose Approver Name</OPTION>";
<%
ResultSet ss = statement.executeQuery("SELECT name from login where desgn='M' and projname='<%=CategoryCombo%>' ");
while(ss.next())
{
ApproverCombo = ss.getString("name");%>
<option value='<%=ApproverCombo%>' /><%out.println(ApproverCombo);%></option>
<% }
%>
</SELECT>
Mar 27 '08 #3
r035198x
13,262 8TB
That won't work. Remember the Java code is processed at the server and the Javascript at the client. Either use AJAX or load all the required values into a Javascript array on page load. You can then manipulate those values (select which ones to display) using Javascript on the client side based on the user's input.
Mar 27 '08 #4
That won't work. Remember the Java code is processed at the server and the Javascript at the client. Either use AJAX or load all the required values into a Javascript array on page load. You can then manipulate those values (select which ones to display) using Javascript on the client side based on the user's input.

thanks for your reply..
i am new to jsp. can you send me code for this all and how to use AJAX in this case because i have to populate both dropdoun list from database..
Mar 28 '08 #5
r035198x
13,262 8TB
thanks for your reply..
i am new to jsp. can you send me code for this all and how to use AJAX in this case because i have to populate both dropdoun list from database..
The codes for that has been written thousands of times and is available all over the internet including in our very own Javascript/AJAX forum
Mar 28 '08 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: cvchen | last post by:
Hello, I'm implementing a data dictionary (catalogging system) that can be searched in several ways. I finished the first version without using...
1
by: jvb | last post by:
Hello, I have got the following problem. I have an access database with the name of different persons and there telephone numbers. In an access...
1
by: bbdobuddy | last post by:
Hi, I have a connection to a SQL database. One of the tables in the SQL Database is DefendentInformation. I would like to get the firstName...
1
by: Leszek | last post by:
Hi I'm using this code to change a table cell into text input: pole=document.createElement("input"); pole.type="text"; pole.size="40";...
6
by: DavidOwens | last post by:
Hey everybody im creating a report for regional managers, i have created a table called STORES, what i want to be able to do is that when the page...
7
by: arti | last post by:
In ASP.Net, I have a Dropdown List bound to a City Table with City Id as Value & City names as Data Text field. I want to Show a few Favourite...
1
by: fran7 | last post by:
Hi, Anyone know how to populate a dropdown list with data from database. I have an interface that generates the following code for names in my...
3
by: fish919 | last post by:
Hello All, I am creating a date base in access. I want to create a dropdown list box that is connected to another dropdown list box. You start...
0
better678
by: better678 | last post by:
Question: Discuss your understanding of the Java platform. Is the statement "Java is interpreted" correct? Answer: Java is an object-oriented...
0
by: teenabhardwaj | last post by:
How would one discover a valid source for learning news, comfort, and help for engineering designs? Covering through piles of books takes a lot of...
0
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge...
0
jalbright99669
by: jalbright99669 | last post by:
Am having a bit of a time with URL Rewrite. I need to incorporate http to https redirect with a reverse proxy. I have the URL Rewrite rules made...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was...
0
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. ...
2
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it...
0
by: Arjunsri | last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.