I’m trying to remove some data from my database, and I need help with my SQL.
Basically this is the result I want to get in my Java code:
DELETE FROM Table1 WHERE name = '***specific value from combobox***'
With INSERT I did this:
String sql = "INSERT INTO Table2 (name) values (?)";
pst = conn.prepareStatement(sql);
String name = ComboBox.getSelectedItem().toString();
pst.setString(1, name);
Now I want to use DELETE instead of insert, something like this:
String sql = "DELETE FROM Table1 WHERE name = values (?)";
pst = conn.prepareStatement(sql);
String name = ComboBox.getSelectedItem().toString();
pst.setString(1, name);
I need help with the SQL string.
You need to update this line.