-
How to read a value from resultsetobjet
Hi,
I have a doubt in servlet, How to read a value from resultsetobjet which is coming from database to textfield.
When we select one value from drop-down list the corresponding value will be displayed in corresponding textfield automatically. I need code in servlets
Question asked by visitor swapna.s
-
Junior Member
Re: How to read a value from resultsetobjet
sorry man i couldnt understand your problem. please explain your problem in eloborated manner, so that i can come with answer.
-
Junior Member
Re: How to read a value from resultsetobjet
Hi,
try this.for eg consider u want to access the field salaray from employee table.
and u r sending empid through request.u r gettign the empid from the dropdown table .consider salary is the second field in employee table.
String result=null;
try
{
Class.forName("url");
Connection conn=Drivermanager.getConnecction("url");
Statemetn stmt=conn.createStatement();
ResultSet rst=stmt.executeQuery("select * from employee where userId = " +(request.getParameter("userID"));
result= rst.getString(2);
}
catch(SQLExceptione){
return result;
}
}
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules