全國最多中醫師線上諮詢網站-台灣中醫網
發文 回覆 瀏覽次數:1344
推到 Plurk!
推到 Facebook!

Who can give a GOOD method?

尚未結案
kylixyao
一般會員


發表:10
回覆:11
積分:4
註冊:2003-11-20

發送簡訊給我
#1 引用回覆 回覆 發表時間:2003-12-05 17:12:50 IP:202.110.xxx.xxx 未訂閱
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

發送簡訊給我
#2 引用回覆 回覆 發表時間:2003-12-05 18:55:37 IP:203.204.xxx.xxx 未訂閱
引言: 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) : 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);
Add Red Code
人生有夢,逐夢而行。 人若為善,福雖未至,禍已遠離。 人若為惡,禍雖未至,福已遠離。 http://www.taconet.com.tw/jieshu/
------
人生有夢,逐夢而行
人若為善,福雖未至,禍已遠離
人若為惡,禍雖未至,福已遠離
http://www.taconet.com.tw/jieshu/
speedup
資深會員


發表:19
回覆:259
積分:280
註冊:2003-07-04

發送簡訊給我
#3 引用回覆 回覆 發表時間:2003-12-08 17:19:05 IP:210.243.xxx.xxx 未訂閱
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

發送簡訊給我
#4 引用回覆 回覆 發表時間:2003-12-09 08:28:57 IP:202.110.xxx.xxx 未訂閱
Thanks JieShu and SpeedUp! pls logon http://www.3asoft.com to see my book "Guide for Interbase70 development" (kylixyao)writen for main China readers. welcome for comment.
kylixyao
一般會員


發表:10
回覆:11
積分:4
註冊:2003-11-20

發送簡訊給我
#5 引用回覆 回覆 發表時間:2003-12-09 08:56:02 IP:202.110.xxx.xxx 未訂閱
Hi,SpeedUp    thanks for great help for me.may I ask you a private question?which company you work for(Borland)?and what's your profession?
Ktop_Robot
站務副站長


發表:0
回覆:3511
積分:0
註冊:2007-04-17

發送簡訊給我
#6 引用回覆 回覆 發表時間:2007-04-30 13:45:07 IP:000.000.xxx.xxx 未訂閱
提問者您好:


以上回應是否已得到滿意的答覆?


若已得到滿意的答覆,請在一週內結案,否則請在一週內回覆還有什麼未盡事宜,不然,
將由版主(尚無版主之區域將由副站長或站長)自由心證,選擇較合適之解答予以結案處理,
被選上之答題者同樣會有加分獎勵同時發問者將受到扣 1 分的處分。不便之處,請見諒。


有問有答有結案,才能有良性的互動,良好的討論環境需要大家共同維護,感謝您的配合。

------
我是機器人,我不接受簡訊.
系統時間:2024-05-08 2:31:29
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!