Database Connectivity
String name=jTextField1.getText(); String email=jTextField2.getText(); String mobile=jTextField3.getText(); if(name.isEmpty()) { JOptionPane.showMessageDialog(this, “Name not Entered”); } else if(email.isEmpty()) { JOptionPane.showMessageDialog(this, “Email not Entered”); } else if(mobile.isEmpty()) { JOptionPane.showMessageDialog(this, “Mobile not Entered”); } else{ try{ Class.forName(“java.sql.DriverManager”); Connection con=(Connection) DriverManager.getConnection(“jdbc:mysql://localhost:3306/pk”, “root”, “1234”); Statement stmt=con.createStatement(); String query=”insert into contactdiary values(“+name+”,”+email+”,”+mobile+”);”; stmt.executeUpdate(query); JOptionPane.showMessageDialog(this, “Account added successfully.”); } catch(Exception e){ JOptionPane.showMessageDialog(this, e.getMessage()); } }Add account String name=jTextField1.getText(); int accno=Integer.parseInt(jTextField2.getText()); int deposit=Integer.parseInt(jTextField3.getText()); String address=jTextField4.getText(); String date=jTextField4.getText(); if(name.isEmpty()) { JOptionPane.showMessageDialog(this, “Name not Entered”); } else if(accno==0) { JOptionPane.showMessageDialog(this, “Email not Entered”); } else if(deposit==0) { JOptionPane.showMessageDialog(this, “Deposit not Entered”);
Essay About String Email And Connection Con
Essay, Pages 1 (143 words)
Latest Update: June 14, 2021
//= get_the_date(); ?>
Views: 25
//= gt_get_post_view(); ?>
Related Topics:
String Email And Connection Con. (June 14, 2021). Retrieved from https://www.freeessays.education/string-email-and-connection-con-essay/