Jump to Real's How-to Main page

DELETE data in a table

Note:the MyConnection class was used to connect to the DB

PreparedStatement prepstmt;
try {     
  prepstmt = theConn.prepareStatement
    ("DELETE FROM tCust "+
     " WHERE custId = ?");
             
  prepstmt.setString(1,cust_id.getText());       
  prepstmt.executeUpdate();
              
  theConn.commit();
  prepstmt.close();
  }
catch (Exception e) {
  e.printStackTrace();
}

If you find this article useful, consider making a small donation
to show your support for this Web site and its content.

Written and compiled by Réal Gagnon ©1998-2005
[ home ]