Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- try{
- Class.forName("com.mysql.jdbc.Driver");
- con = DriverManager.getConnection("jdbc:mysql://localhost:3306/bank","root","fatalcoder524");
- PreparedStatement stmt=con.prepareStatement("select * from accounts where "+searchstr+"=?");
- stmt.setString(1, jTextField1.getText());
- ResultSet rs = stmt.executeQuery();
- if(rs.next())
- {
- JOptionPane.showMessageDialog(null, "Account or Customer ID found.", "Account Status", JOptionPane.INFORMATION_MESSAGE);
- con.close()
- }
- else
- {
- JOptionPane.showMessageDialog(null, "No Account or Customer ID found.", "Deposit Status", JOptionPane.ERROR_MESSAGE);
- con.close();
- }
- }catch(Exception e)
- {
- System.out.println(e);
- }
Add Comment
Please, Sign In to add comment