Who can give a GOOD method? |
尚未結案
|
kylixyao
一般會員 發表:10 回覆:11 積分:4 註冊:2003-11-20 發送簡訊給我 |
in client,users have two different tables needed to be applyupdate in the same transaction for their integrity.these two table are not master detail relation.if applyupdates in client,then if internet connection lost,the transaction will dead.so I defined a method in middle layer which recieive the client's delta as parametre,this method then start transaction and call datasetprovider's applyupdates to do the real updates to the underlining database.the question is:if datasetprovider updates occur error,how to show these error and those un-updated records to the client?we know if we call clientdataset's applyupdates,these would work well with its onreconcile event.
in middle,the interface method pesucode like:
save(delta1:olevariant):
begin
starttransaction;
try
datasetprovider1.applyupdates(delta1,0,errorcnt);
datasetprovider2.applyupdates(delta2,0,errorcnt);
commit;
except
rollback;
end;
in client,call this method:appserver.save(clientadataset1.delta,cliendataset2.delta);
| ||
jieshu
版主 發表:42 回覆:894 積分:745 註冊:2002-04-15 發送簡訊給我 |
引言: the question is:if datasetprovider updates occur error,how to show these error and those un-updated records to the client?we know if we call clientdataset's applyupdates,these would work well with its onreconcile event. in middle,the interface method pesucode like:Add Red Codesave(delta1:olevariant) : String; begin starttransaction; try datasetprovider1.applyupdates(delta1,0,errorcnt); datasetprovider2.applyupdates(delta2,0,errorcnt); commit; Result := ''; except on E : Exception do begin Result := E.Message; rollback; end; end; in client,call this method: Error := appserver.save(clientadataset1.delta,cliendataset2.delta); if Error <> '' then ShowMessage(Error);
------
人生有夢,逐夢而行 人若為善,福雖未至,禍已遠離 人若為惡,禍雖未至,福已遠離 http://www.taconet.com.tw/jieshu/ |
||
speedup
資深會員 發表:19 回覆:259 積分:280 註冊:2003-07-04 發送簡訊給我 |
if You want to process reconcile Error in client ,you may redeclare your methord as
In Server Tier Procedure Save(Delta1,Delta2:OleVariant; Out vReconcile1,vReconcile2:OleVariant; Out ErrorCount:Integer); var ec1,ec2:Integer; begin starttransaction; try vReconcile1 :=Datasetprovider1.Applyupdates(Delta1,0,ec1); vReconcile2 :=Datasetprovider2.Applyupdates(Delta2,0,ec2); ErrorCount := ec1 ec2;//ec1 add ec2 if ErrorCount = 0 then commit else rollback; except rollback; raise; end; end; in Client var vReconcile1,vReconcile2:OleVariant; errorCount:Integer; begin .... xxx.AppServer.Save(ClientDataSet1.Delta,ClientDataSet2.Delta, vReconcile1,vReconcile2,ErrorCount); if ErrorCount = 0 then begin ClientDataSet1.Reconcile(vReconcile1); ClientDataSet2.Reconcile(vReconcile2); ClientDataSet1.MergeChangeLog; ClientDataSet2.MergeChangeLog; end else begin if not VarIsNUll(vReconcile1) then ClientDataSet1.Reconcile(vReconcile1); if not VarIsNUll(vReconcile2) then ClientDataSet2.Reconcile(vReconcile2); end; end;then you may process reconcile error in OnReconcileError Event. 混心雜欲 棄修身~唉
------
唉~ |
||
kylixyao
一般會員 發表:10 回覆:11 積分:4 註冊:2003-11-20 發送簡訊給我 |
|||
kylixyao
一般會員 發表:10 回覆:11 積分:4 註冊:2003-11-20 發送簡訊給我 |
|||
Ktop_Robot
站務副站長 發表:0 回覆:3511 積分:0 註冊:2007-04-17 發送簡訊給我 |
本站聲明 |
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。 2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。 3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇! |