See com.borland.dx.sql.dataset.ResolutionException error code: BASE+2
表示删除失败。
public final void deleteRow()
Deletes the current row of the DataSet. If the current row is new or being edited, the edit state is canceled and the new or edited row is deleted. On failure, this method throws a DataSetException.
这里queryDataSet.deleteRow()是删除你正在编辑而没有提交的数据(也就是current row),不能对已经提交的或者本来就在数据库里存在的数据进行删除操作。
如果你使用过Golden这个软件,这句的动作相当于编辑状态时的“×”这个按钮,而不是 “-” 。
如果需要进行删除已在数据库中数据的操作,要使用SQL语句来实现。
类中有一个database,一个jdbTable,一个queryDataSet.jdbTable和queryDataSet绑定.queryDataSet的query属性为"SELECT * FROM tblDept",测试成功.metaDataUpdate设为None.将queryDataSet下的DeptCode列的rowId属性设为true.添加一个jButton1,作用是删除一行数据:queryDataSet1.deleteRow(); queryDataSet1.saveChange();
运行后jdbTable中数据正确显示,可是点击jButton1时,出现错误:
Exception occurred during event dispatching:
See com.borland.dx.sql.dataset.ResolutionException error code: BASE+2
com.borland.dx.sql.dataset.ResolutionException: An error occurred deleting a row in the "tblDept" table
我使用queryDataSet1.saveChange()时出现如下错误:
Exception occurred during event dispatching:
See com.borland.dx.sql.dataset.ResolutionException error code: BASE+2
com.borland.dx.sql.dataset.ResolutionException: An error occurred deleting a row in the "tblDept" table