private void deleteActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
try{
Connection con=null;
Statement st;
ResultSet rs;
con=DriverManager.getConnection("jdbc:mysql://localhost:3306/mall","root","");
st=con.createStatement();
DefaultTableModel model = (DefaultTableModel)speedster.getModel();
int SelectedRowIndex = speedster.getSelectedRow();
//model.removeRow(SelectedRowIndex);
Object o = speedster.getValueAt(SelectedRowIndex,0);
String query1 = "delete from app where uid="+o+"";
while(model.getRowCount()>0)
{
rs = st.executeQuery("select * from app");
if(rs.getString("UID")==o)
{
//model.removeRow(SelectedRowIndex);
//String query1 = "delete from app where uid='"+o+"'";
st.executeQuery(query1);
}
}
}
catch(SQLException ex)
{
JOptionPane.showMessageDialog(this,"Cannot delete the selected item.");
}
}