not getting an error but this code is not working properly.  
Author Message
sona_raj





PostPosted: 2006-4-4 17:56:00 Top

java-programmer, not getting an error but this code is not working properly. this code is to delete a record from an access database.there is no
error but the record is not getting deleted from database.
please help me in this regard.
thanks in advance.
code:
if(JTCurrentJobTable.getValueAtJTCurrentJobTable.getSelectedRow),JTCurrentJobTable.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]);
if(PromptResult==0){stCurrentJob.execute("DELETE * FROM
tblCurrentJob WHERE CurrentJobIndex= " +
JTCurrentJobTable.getValueAt(JTCurrentJobTable.getSelectedRow(),0));
reloadRecord();
JOptionPane.showMessageDialog(null,"Record has been successfully
deleted.","Comfirm Delete",JOptionPane.INFORMATION_MESSAGE);
}

 
Oliver Wong





PostPosted: 2006-4-7 1:33:00 Top

java-programmer >> not getting an error but this code is not working properly.
"sona_raj" <email***@***.com> wrote in message
news:email***@***.com...
> this code is to delete a record from an access database.there is no
> error but the record is not getting deleted from database.
> please help me in this regard.
> thanks in advance.
> code:
> if(JTCurrentJobTable.getValueAtJTCurrentJobTable.getSelectedRow),JTCurrentJobTable.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]);
> if(PromptResult==0){stCurrentJob.execute("DELETE * FROM
> tblCurrentJob WHERE CurrentJobIndex= " +
> JTCurrentJobTable.getValueAt(JTCurrentJobTable.getSelectedRow(),0));
> reloadRecord();
> JOptionPane.showMessageDialog(null,"Record has been successfully
> deleted.","Comfirm Delete",JOptionPane.INFORMATION_MESSAGE);
> }
>

Maybe you should omit the asterix after "DELETE" and before "FROM".

- Oliver

 
scoffer





PostPosted: 2006-4-7 18:57:00 Top

java-programmer >> not getting an error but this code is not working properly. Hi,

try with a commit after the delete command and before the reloadRecord.

Bye.

"sona_raj" <email***@***.com> ha scritto nel messaggio
news:email***@***.com...
> this code is to delete a record from an access database.there is no
> error but the record is not getting deleted from database.
> please help me in this regard.
> thanks in advance.
> code:
> if(JTCurrentJobTable.getValueAtJTCurrentJobTable.getSelectedRow),JTCurrentJobTable.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]);
> if(PromptResult==0){stCurrentJob.execute("DELETE * FROM
> tblCurrentJob WHERE CurrentJobIndex= " +
> JTCurrentJobTable.getValueAt(JTCurrentJobTable.getSelectedRow(),0));
> reloadRecord();
> JOptionPane.showMessageDialog(null,"Record has been successfully
> deleted.","Comfirm Delete",JOptionPane.INFORMATION_MESSAGE);
> }
>