关于applyupdates(0)问题(12分)

  • 主题发起人 主题发起人 royhgf
  • 开始时间 开始时间
R

royhgf

Unregistered / Unconfirmed
GUEST, unregistred user!
客户端可以applyupdates(0),但是就是当有错误发生时(比如数据库中存在相同记录,或者几个人同时更新记录)系统无法捕捉到,仍然提示成功,请问如何确定数据提交成功,请给出简单的例子.
 
applyupdates(0)返回值为0表明保存成功!否则就失败
 
返回值有哪些,分别代表什么,我希望根据返回值提示用户哪里出错!!!
 
出错代码就要在cds的事件onReconcileError中取得,如: &nbsp;ErrorMsg:=E.Message;<br>&nbsp; ErrorCode:=E.ErrorCode;
 
{*******************************************************}<br>{ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br>{ &nbsp; &nbsp; &nbsp; Delphi Visual Component Library &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br>{ &nbsp; &nbsp; &nbsp; ClientDataSet Standard Reconcile Error Dialog &nbsp; }<br>{ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br>{ &nbsp; &nbsp; &nbsp; Copyright (c) 1998 Borland International &nbsp; &nbsp; &nbsp; &nbsp;}<br>{ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br>{*******************************************************}<br><br>{ Note: To use this dialog you should add a call to HandleReconcileError in<br>&nbsp; the OnReconcileError event handler of TClientDataSet (see the Client dataset<br>&nbsp; demos for an example). &nbsp;Also, after adding this unit to your project you must<br>&nbsp; go into the Project Options dialog and remove this form from the list of<br>&nbsp; Auto-created forms or an error will occur when compiling. }<br><br>unit DataSetError;<br><br>找到 Delphi自已提供的 dataSetError.pas单元,照上面的用法,在<br>ClientDataSet.OnReconcileError事件中写下就可以了,什么错误,怎么处理都一目了然<br>&nbsp; Action := DataSetError.HandleReconcileError(DataSet,UpdateKind, E);
 
if ClientDataSet.applyupdates(0) &gt; 0 then<br>&nbsp;raise Exception.Create('数据提交失败!');
 
还是不够详细,不明白怎么操作
 
后退
顶部