prob.. confirm message
hey...
its the updation query.In this page when i click the update button it updates the values in the row..and this query is working...
I want to do that..when i click a update button it gives me a confirms message whether did u want to update the row and also displaying the particular gl_code no in that confirms message.when i click on yes it updates the row..otherwise it doesnot.
after updation it shows message that this particular gl_code no is has been updated.
<%
String action = request.getParameter("action");
if (action != null && action.equals("update")) {
conn.setAutoCommit(false);
PreparedStatement pstatement = conn.prepareStatement(
"UPDATE gl_mast SET gl_descr = ?, db_amt = ?, " +
"cr_amt = ?, gl_type = ? , gl_pct = ? WHERE gl_code=?");
pstatement.setString(1, request.getParameter("gl_descr"));
pstatement.setFloat(2,Float.parseFloat(request.get Parameter("db_amt")));
pstatement.setFloat(3,Float.parseFloat(request.get Parameter("cr_amt")));
pstatement.setString(4, request.getParameter("gl_type"));
pstatement.setFloat(5,Float.parseFloat(request.get Parameter("gl_pct")));
pstatement.setInt(6,Integer.parseInt(request.getPa rameter("gl_code")));
int rowCount = pstatement.executeUpdate();
conn.setAutoCommit(false);
conn.setAutoCommit(true);
}
%>
<%
Statement statement = conn.createStatement();
ResultSet rs = statement.executeQuery
("SELECT * FROM gl_mast ");
%>
<form action="gl_update.jsp" method="get">
<input type="hidden" value="update" name="action">
<tr>
<td><input value="<%= rs.getInt("gl_code") %>" size="5" name="gl_code"></td>
<td><input value="<%= rs.getString("gl_descr") %>" size="55" name="gl_descr"></td>
<td><input value="<%= rs.getFloat("db_amt") %>" size="12" name="db_amt"></td>
<td><input value="<%= rs.getFloat("cr_amt") %>" size="12" name="cr_amt"></td>
<td><input value="<%= rs.getString("gl_type") %>" size="3" name="gl_type"></td>
<td><input value="<%= rs.getFloat("gl_pct") %>"size="5" name="gl_pct"></td>
<td><input type="submit" value="Update"></td>
</tr>
</form>
|