Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- String a = JOptionPane.showInputDialog(null, "What flavor do you want to add?");
- String sql = "INSERT INTO tblFlavor values('+a+')";
- try {
- Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
- String connectionURL = "jdbc:sqlserver://localhost:1433;databaseName=finalsTableDB;user=admin;password = password";
- Statement st = con.createStatement();
- int i = st.executeUpdate(sql);
- if (i > 0) {
- JOptionPane.showMessageDialog(null, "Successfully Added!!");
- }
- } catch (Exception e) {
- JOptionPane.showMessageDialog(null, "Failed To Add!!!");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement