
DBUtil util = new DBUtil();
try {
JOptionPane.showMessageDialog(null, "Connection Opened!");
Connection con = util.getConnection();
PreparedStatement stmt = con.prepareStatement("INSERT INTO dbo.mut_det(rm_id,box_no,weight,note_state,dm_state,[1]) VALUES (?,?,?,?,?,?)");
String rm = (tf_rm_id.getText().trim() == null || tf_rm_id.getText().equals("")) ? "0" : tf_rm_id.getText();
String a = (txtRe1.getText().trim() == null || txtRe1.getText().equals("")) ? "0" : txtRe1.getText();
cbdmnstat.getSelectedItem().equals("")) ? "0" : cbdmnstat.getSelectedItem();
stmt.setInt(1, Integer.parseInt(rm));
stmt.setInt(2, Integer.parseInt(bn));
stmt.setString(3, ""+(bw));
stmt.setString(4, ""+ns);
stmt.setString(5, ""+ds);
stmt.setInt(6, Integer.parseInt(a));
stmt.execute();
} catch (Exception ex) {
JOptionPane.showMessageDialog(null, ex.getMessage());
Logger.getLogger(Demo.class.getName()).log(Level.SEVERE, null, ex);
}

i want to retrieve values from database and display them in my textfields... please help the above code id of insert but i tried with select it show error what to do please help..!! :-(
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.