Skip to main content

Posts

Showing posts with the label java program delete record from table using PreparedStatement

java MS ACCESS insert,update delete using PreparedStatement

java program delete record from table using  PreparedStatement java MS ACCESS  insert,update  delete using  PreparedStatement import java.sql.*; class DeletePreparest {   public static void main(String s[])   {     try {   int cno=Integer.parseInt(s[0]);  Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");  Connection con=DriverManager.getConnection("jdbc:odbc:demodb"); // Statement smt=con.createStatement();  PreparedStatement psmt=con.prepareStatement("delete from demo where id=?");  psmt.setInt(1,cno);  int result=psmt.executeUpdate();       System.out.println("record deleted"+result);  con.close(); } catch(Exception e){    System.out.println("exce"+e);}         } }

Labels

Show more