我的Jtable选中的那行数据界面上可以删除,可是数据库删除过后,仍然存在
代码如下:JTable监听事件
deletebtn.addActionListener(new ActionListener(){
         public void actionPerformed(ActionEvent Event){
         int row = table.getSelectedRow();
         if ( row >= 0 ) {
         String string[] = new String[3];
      string[0] = (String) table.getValueAt(row, 0);
      string[1] = (String) table.getValueAt(row, 1);
      MemoDAO.DeleteMemoByDateANDContent(string[1], string[0]);//删除数据库数据
      defaultmodel.removeRow(row);
         }
         table.revalidate();
         }
        });数据库删除操作:
public static void DeleteMemoByDateANDContent(String s1, String s2 ){
  //建立数据库连接
  Connection con=DBCon.getCon();
  //建立会话
  try {
   Statement stmt=con.createStatement();
   //定义sql语句    
   String sqlString="delete from memorecord where memoContent='"+s1+"'memoDate='"+s2+"';";
   //执行sql语句
   stmt.execute(sqlString);
    } 
  }请大神们看看啊,为什么数据库中仍然存在数据

解决方案 »

  1.   

    sql语句是不是有问题,多条件我一般都加and
      

  2.   

    先看看这条sql语句在数据库内是否能正确执行,不过如果有问题的话是不是应该报错呀
      

  3.   

    我用Oracle数据库一般都这么写的:
    定义sql语句   
    String sqlString="delete from memorecord where memoContent=? and memoDate=?";
    PreparedStatement ps=conn.prepareStatement(sqlString);
    ps.setString(1,s1);ps.setString(2,s2);
    ps.executeUpdate();
      

  4.   

    sql拼接可能存在问题,因为我以前也遇到过类似的问题