DeleteRow();SaveChanges() throws exception..Please help


2004-07-16 12:44:05 AM
jbuilder10
Ok... finally I've done it, my brain's smokn' fried...
Thank you sooooo much in advance for ANY ANY help on this issue
I only want to delete a row form the JDBTABLE and the DATASET but this
task is becoming almost impossible.
Senario1: did not work...
i have a JDBTABLE which is connected to qryEnrollment. Upone the user
selecting a record and clicking on the delete button, i want to delete
that record.
appDataModule.getQryEnrollment().setEnableDelete(true);
appDataModule.getQryEnrollment().deleteRow();
appDataModule.getQryEnrollment().saveChanges();
O R
jdbTable1.getDataset.deleteRow();
jdbTable1.getDataset.saveChanges();
it throws the following exception:
Exception occurred during event dispatching:
See com.borland.dx.dataset.DataSetException error code: BASE+51
com.borland.dx.dataset.DataSetException: The row specified by the
resolution query was not found.
Typical reasons are:
Somebody deleted or changed this row.
A floating point comparison failed to match.
A CHAR field needs space padding (see
Database.setUseSpacePadding).
Query:
Query:
null
Row values used for finding existing row:
EnrollmentID=5:FK_ClassID=1:FK_CourseID=1:FK_PersonID=75:EnrollmentDateTimeStamp=7/12/04
2:13:50 PM:AuthUserName=:FK_PersonID_AuthoUser=0:Completed=0:StartDate=2/2/04:StartTime=12:00:00
AM:EndDate=:EndTime=12:00:00 AM
at com.borland.dx.dataset.DataSetException.a(Unknown Source)
at com.borland.dx.dataset.DataSetException.noRowsAffected(Unknown
Source)
at com.borland.dx.sql.dataset.l.a(Unknown Source)
at com.borland.dx.sql.dataset.l.a(Unknown Source)
at com.borland.dx.sql.dataset.QueryResolver.deleteRow(Unknown Source)
at classscheduler.Enroll.deleteRecFromDataSet(Enroll.java:630)
at classscheduler.Enroll.removeFromEnrollment(Enroll.java:657)
at classscheduler.Enroll.btnRemoveFromEnroll_actionPerformed(Enroll.java:614)
at classscheduler.Enroll_btnRemoveFromEnroll_actionAdapter.actionPerformed(Enroll.java:1056)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1786)
at javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(AbstractButton.java:1839)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:420)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:258)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:245)
at java.awt.Component.processMouseEvent(Component.java:5100)
at java.awt.Component.processEvent(Component.java:4897)
I then associated a query resolver to the dataset (qryEnrollment) and
it still threw the same exception. The interesting thing is the query
resolver displayed the right record id to delete while the query
displayed the wrong one (the index in the tale)
Scenario 2: also did not work
i proceeded with coding the delete query manually and it still threw
the same exact error even though I supplied the correct index in to
the table... code follows:
i checked the string through debug and it displayed the right stuff.
i copies the string and pasted it in MySql command line and it
worked.... so it is not the string).
QueryDataSet qryDelete = new QueryDataSet();
String tempvar = "Delete from " + wstableName + " where " +
wsParam1 +
" = " + tempVarInt;
qryDelete.setQuery(new com.borland.dx.sql.dataset.
QueryDescriptor(appDataModule.getDatabase1(),
tempvar, true));
// qryDelete.open();
qryDelete.setEnableDelete(true);
qryDelete.executeQuery();
I do not know what i am doing wrong... but i am going nuts. Thanks
and please help