File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and the fly likes Error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Error" Watch "Error" New topic


sona raj

Joined: Apr 05, 2006
Posts: 1
this is to delete record from database, no error is been showed but the record is not been deleted from database.'m using ms access.

if(JTPersonalTable.getValueAt(JTPersonalTable.getSelectedRow(),JTPersonalTable.getSelectedColumn()) != null){
String ObjButtons[] = {"Yes","No"};
int PromptResult = JOptionPane.showOptionDialog(null,"Are you sure you want to delete the selected record?","Delete Record",JOptionPane.DEFAULT_OPTION,JOptionPane.ERROR_MESSAGE,null,ObjButtons,ObjButtons[1]);
stPersonal.executeUpdate("DELETE * FROM tblPersonal WHERE PersonalIndex= " + JTPersonalTable.getValueAt(JTPersonalTable.getSelectedRow(),0));
JOptionPane.showMessageDialog(null,"Record has been successfully deleted.","Comfirm Delete",JOptionPane.INFORMATION_MESSAGE);
David O'Meara

Joined: Mar 06, 2001
Posts: 13459

Try either setting autocommit(true) on the connection or doing a dummy select after the delete. This is a common bug in the JDBC-ODBC bridge.

In future, please use a meaningful topic and use the code tags. You can see more hints on writing questions better in my signature...

I agree. Here's the link:
subject: Error
Similar Threads
recNo choice
nx: All of URLy Bird 1.1.3 read/write lock(2)
Not able to delete a record
my result holding null values