954,198 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Combo box and Ms-access

how can I extract all the values of one field from the database table (ex : all the names from the field NAME) and put them in a combo box in run time in the dynamically generated page…

and secondly, if all the values are available in the combo box, how can I select one value at a time from the combo box and store that value in a variable during run time…

rittik
Newbie Poster
1 post since Mar 2007
Reputation Points: 10
Solved Threads: 0
 
how can I extract all the values of one field from the database table (ex : all the names from the field NAME) and put them in a combo box in run time in the dynamically generated page… and secondly, if all the values are available in the combo box, how can I select one value at a time from the combo box and store that value in a variable during run time…




hai..

I just give you the code for displaying and storing the values in the run time(part of code).


<%
//query for selecting the values from the database
pstmt1=con.createStatement();
rs=pstmt1.executeQuery("select * from test.emp");
%>




Select the Employee Id from the Combo box

<%
while(rs.next())
{
%>
"><%=rs.getString("empid")%>
<%
}
%>






<%
id=request.getParameter("eid");
%>

Thendral
Newbie Poster
14 posts since Feb 2007
Reputation Points: 10
Solved Threads: 0
 

NEVER try to connect to database from JSP!
If you need data from DB use servlet and then pass them to your JSP...

peter_budo
Code tags enforcer
Moderator
15,436 posts since Dec 2004
Reputation Points: 2,806
Solved Threads: 901
 
NEVER try to connect to database from JSP! If you need data from DB use servlet and then pass them to your JSP...



Hai..

I am also beginner for Jsp.
Can you please tell me the reason(for not connecting the DB from JSP) so that i can understand the concept well.

Thanking you.

Thendral
Newbie Poster
14 posts since Feb 2007
Reputation Points: 10
Solved Threads: 0
 

JSP is a display technology, it is NOT meant to contain business logic.

jwenting
duckman
Team Colleague
8,392 posts since Nov 2004
Reputation Points: 1,662
Solved Threads: 337
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You