Click here to Skip to main content
11,642,233 members (64,737 online)
Rate this: bad
good
Please Sign up or sign in to vote.
See more: JSP
Hello, The problem is Code is working when rs.getString
(1) is integer number, but in my case it's a varchar primary key , how to fix this.

function getId(id){
    var f=document.form;
    f.method="post";
    f.action='SelectBank1.jsp?id='+id;
    f.submit();
}
<%
Statement stmt = conn.createStatement();
    ResultSet rs = stmt.executeQuery("select IdwhichIsVarchar, description from  SomeDataBase where IS_VISIBLE = 1 order by description  ");
%>
 
<%
while(rs.next()){
%>
<tr><td><%=rs.getString(2)%></td>
 
<td><input type="button" name="edit" value="Edit" style="background-color:green;font-weight:bold;color:white;" onclick="getId(<%=rs.getString(1)%>);" ></td>
</tr>
<%
}
%>
Posted 4-Dec-12 8:15am
krasi89352
Edited 4-Dec-12 8:52am
(no name)90.5K
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



Advertise | Privacy | Mobile
Web04 | 2.8.150731.1 | Last Updated 4 Dec 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100