Query 問題 |
尚未結案
|
mygod
一般會員 ![]() ![]() 發表:52 回覆:64 積分:23 註冊:2002-09-10 發送簡訊給我 |
|
kgt
高階會員 ![]() ![]() ![]() ![]() 發表:17 回覆:308 積分:165 註冊:2002-03-13 發送簡訊給我 |
1.POST-->
新增或修改一筆記錄要存檔時 2.CommitUpdates-->請參照註解 procedure TForm1.ApplyButtonClick(Sender: TObject); begin
with CustomerQuery do
begin
Database1.StartTransaction;
try
ApplyUpdates; {try to write the updates to the database};
Database1.Commit; {on success, commit the changes};
except
Database1.Rollback; {on failure, undo the changes};
raise; {raise the exception to prevent a call to CommitUpdates!}
end;
CommitUpdates; {on success, clear the cache}
end;
end;
|
T.J.B
版主 ![]() ![]() ![]() ![]() ![]() 發表:29 回覆:532 積分:497 註冊:2002-08-14 發送簡訊給我 |
引言: 請問POST跟CommitUpdates的使用時機,謝謝 oh~mygodPost <-----將資料暫存在Buffer尚未寫回資料庫 CommitUpdates <---- 清除cache中的異動資料 當ApplyUpdates後 可執行此指令將cache中的異動資料清除 以保持Server與Cache的資料一致 如此才可以避免下一次執行 ApplyUpdates時發生錯誤 有一點加以說明 如果下Post以後離開程式或跳離該事件時 則將會把資料 自動寫回資料庫 就醬子 < >< > 回首來時路 也無風雨也無晴~~@.@
------
天行健 君子當自強不息~~@.@ |
本站聲明 |
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。 2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。 3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇! |