问题是当 rs.getString (1) 是整数时代码正在工作,但在我的情况下它是一个 varchar 主键,如何解决这个问题。
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>
<%
}
%>