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

ADOTable/Refresh与Requery

答題得分者是:max5020
leonli80
一般會員


發表:29
回覆:27
積分:11
註冊:2006-08-01

發送簡訊給我
#1 引用回覆 回覆 發表時間:2008-03-26 20:24:33 IP:58.33.xxx.xxx 訂閱
請問各位Refresh与Requery 兩者在使用中的區別。
yubad2000
中階會員


發表:0
回覆:44
積分:78
註冊:2007-09-30

發送簡訊給我
#2 引用回覆 回覆 發表時間:2008-03-28 07:53:28 IP:66.171.xxx.xxx 未訂閱
procedure Refresh;

C syntax:

void __fastcall Refresh(void);

Description

Call Refresh to ensure that an application has the latest data from a database. For example, when an application turns off filtering for a dataset, it should immediately call Refresh to display all records in the dataset, not just those that used to meet the filter condition.

Note: The Refresh method does not work for all TDataSet descendants. In particular, TQuery components do not support the Refresh method if the query is not ive? To refresh a static TQuery, close and reopen the dataset.

TDataSet generates a BeforeRefresh event before refreshing the records and an AfterRefresh event afterwards.

Note: Most datasets try to maintain the current record position when you call refresh. However, this is not always possible. For example, the current record may have been deleted from the server by another user. Unidirectional datasets have no mechanism for locating the current record after a refresh, and always move back to the first record.

Warning: Unidirectional datasets refresh the data by closing and reopening the cursor. This can have unintended side effects if, for example, you have code in the BeforeClose, AfterClose, BeforeOpen, or AfterOpen event handlers.


procedure Requery(Options: TExecuteOptions = []);

C syntax:

void __fastcall Requery(TExecuteOptions Options = TExecuteOptions());

Description

Call Requery to refresh the recordset. Requery updates the dataset by re-executing the original command or SQL statement that produced the recordset.

The effects of Requery are the same as calling the dataset Close method and then its Open method. However, there are circumstances when one means of refreshing the recordset is better than the other. The values in properties like CursorLocation, CursorType, and LockType cannot be changed while the dataset is open, so Requery can only refresh the recordset using the existing values in these properties. To refresh the recordset using different values for these properties, effect the refresh using the Close and Open methods.

Options is a TExecuteOptions value that specifies the characteristics of the command execution affected by the requery that produces the recordset for the dataset.
===================引 用 leonli80 文 章===================
請問各位Refresh与Requery 兩者在使用中的區別。
------
===波士頓夜未眠===
What a wonderful world!!
Jazz up the world with jazz!!
==================

When I am not programming...
you can find me here:
http://www.holy-war.de/EN/World3/bin/?advertiser=63190
max5020
資深會員


發表:30
回覆:277
積分:321
註冊:2003-06-04

發送簡訊給我
#3 引用回覆 回覆 發表時間:2008-04-16 11:51:50 IP:59.120.xxx.xxx 訂閱
yubad2000大大PO的英文看不懂嗎??
意思大約是說,
TTable.Refresh主要是用在像,
例如Table.Filterd:= true;
Table.Refresh; 這樣就能更新Dataset目前的Filter內容,
Table並沒有重啟,

但是TTable.Request,
則是等同於TTable.Close; TTable.Open;
Dataset內容是重新Load的!!

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