wood burning stoves 2.0*
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
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Error" Watch "Error" New topic
Author

Error

sona raj
Greenhorn

Joined: Apr 05, 2006
Posts: 1
hi,
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){
System.out.println(JTPersonalTable.getValueAt(JTPersonalTable.getSelectedRow(),JTPersonalTable.getSelectedColumn()));
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]);
if(PromptResult==0){
stPersonal.executeUpdate("DELETE * FROM tblPersonal WHERE PersonalIndex= " + JTPersonalTable.getValueAt(JTPersonalTable.getSelectedRow(),0));
System.out.println(JTPersonalTable.getValueAt(JTPersonalTable.getSelectedRow(),0));
reloadRecord();
JOptionPane.showMessageDialog(null,"Record has been successfully deleted.","Comfirm Delete",JOptionPane.INFORMATION_MESSAGE);
}
}
David O'Meara
Rancher

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...

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