Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- String val = txt_val.getText();
- String col = txt_col.getText();
- Connection conn = null;
- PreparedStatement pstmt = null;
- ResultSet rs = null;
- try{
- Class.forName("com.mysql.jdbc.Driver");
- conn = DriverManager.getConnection("jdbc:mysql://localhost/net","root","");
- pstmt.setString(1,val);
- pstmt.setString(2,val);
- pstmt.setString(3,col);
- pstmt.setString(4,col);
- int i = pstmt.executeUpdate();
- if(i>0)
- {
- JOptionPane.showMessageDialog(null,"done");
- }
- else
- {
- JOptionPane.showMessageDialog(null,"query failed");
- }
- }
- catch(Exception e){
- JOptionPane.showMessageDialog(null,e);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement