Private Void Double: Txtid
Private Void Double: Txtid
JFrame (Edit.java)
btnSubmit Will Submit the changes you’ve made on the Product Description and Price… the Product ID will
remains the same.
id=txtID.getText();
try {
Connection kon;
ResultSet rs;
PreparedStatement stmt;
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
rs = stmt.executeQuery();
if(rs.next())
des=rs.getString("Product");
price=rs.getDouble("Price"));
txtDes.setText(des);
txtPrice.setText(Double.toString(price));
else
catch(Exception e){}}
}
private void btnSubmitActionPerformed(java.awt.event.ActionEvent evt) {
try {
id=txtUser.getText();
des=txtDes.getText();
price= Double.parseDouble(txtDes.getText());
Connection kon;
ResultSet rs;
Statement stmt;
String query;
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
stmt = kon.createStatement();
int j = stmt.executeUpdate(query);
stmt.close();
kon.close();
} catch (Exception e) {
System.out.println(e);