In this tutorial will teach jdbc record insertion into mysql database step by step.
Connection con; PreparedStatement pst; public void Connect() { try { Class.forName("com.mysql.jdbc.Driver"); //Register the mysql driver con = DriverManager.getConnection("jdbc:mysql://localhost/phonebook","root",""); } catch (ClassNotFoundException ex) { ex.printStackTrace(); } catch (SQLException ex) { ex.printStackTrace(); } }
try { String friendname,phone,place; friendname = txtFname.getText(); phone = txtphone.getText(); place = txtplace.getText(); pst = con.prepareStatement("insert into records(fname,phone,place)values(?,?,?)"); pst.setString(1,friendname); pst.setString(2,phone); pst.setString(3,place); int status = pst.executeUpdate(); if(status==1) { JOptionPane.showMessageDialog(this, "Record Saved"); txtFname.setText(""); txtphone.setText(""); txtplace.setText(""); txtFname.requestFocus(); } else { JOptionPane.showMessageDialog(this, "Record Failed"); } } catch (SQLException ex) { ex.printStackTrace(); }
In this tutorial will teach Laravel 11 Api MVC with Repository Pattern Crud Application step…
In this tutorial will teach Laravel 11 CRUD Application step by step. Laravel 11 CRUD…
in this tutorials we will be talk about how to make a times table in…
In this tutorials will teach How to add two numbers in Laravel 10. (more…)
In this tutorial, we will teach the process of building a full-stack application using Node.js,…
In this tutorial, we will explin you through the process of building a Hospital Management…