Friday, August 9, 2013

Java SearchKeyTyped

private void jTextField_SearchKeyTyped(java.awt.event.KeyEvent evt) {                                          
         clear();
                
                ax = jTextField_Search.getText().trim();
                String sql = "Select * from dclemployee where EmpId like ? or DclFirstname like ? or DclLastname like ? or DclPhoneC like ? or DclEmail like ?";
              
            //JOptionPane.showMessageDialog(this, jTable_Roles.getModel().getValueAt(row, 0).toString());
          
        try {
             
              pst = conn.prepareStatement(sql);
              pst.setString(1,  "%" + ax );
              pst.setString(2, ax + "%");
              pst.setString(3, ax + "%");
              pst.setString(4, ax + "%");
              pst.setString(5, ax );
              rs = pst.executeQuery();

}

No comments:

Post a Comment