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

ADODataSet元件的Cursor Type屬性和LockType屬性請教

尚未結案
cashxin2002
版主


發表:231
回覆:2555
積分:1937
註冊:2003-03-28

發送簡訊給我
#1 引用回覆 回覆 發表時間:2003-07-02 22:59:31 IP:63.84.xxx.xxx 未訂閱
請教各位前輩﹕ ADODataSet元件的Cursor Type屬性中的ctUnspecified, ctOpenForwardOnly, ctKeyset, ctDynamic, ctStatic值各代表何意義﹖ LockType的屬性中的ItUnspecified, ItReadOnly, ItPessimistic, ItOptimistic, ItBatchOptimistic值各代表何意義﹖ 小弟有去看Delphi的說明檔資料﹐但對其中的意義還不是很清楚﹐所以勞煩前輩們講解一下﹒ 感激不盡﹗ 努力,相信會獲得美麗! 忻晟 發表人 - cashxin2002 於 2003/07/02 23:54:24
------
忻晟
領航天使
站長


發表:12216
回覆:4186
積分:4084
註冊:2001-07-25

發送簡訊給我
#2 引用回覆 回覆 發表時間:2003-07-10 23:17:37 IP:210.202.xxx.xxx 未訂閱
列出原文 TCursorType valies indicate the type of cursor to use for a recordset. Unit ADOdb type TCursorType = (ctUnspecified, ctOpenForwardOnly, ctKeyset, ctDynamic, ctStatic); Description Use TCursorType values to indicate the type of cursor to use when a recordset is opened. The constants of TCursorType correspond with the CursorTypeEnum values for the CursorType property of the ADO recordset object. See the Microsoft Data Access SDK help for information on these values and their effects. TCursorType consists of the five constants summarized in the following table: Cursor Type Meaning ctUnspecified A specific cursor type has not yet been specified. ctOpenForwardOnly Forward-only cursor in which you can only scroll forward; better performance because only requires single through recordset. ctKeyset Keyset cursor; records added by other users are not visible; records deleted by other users are inaccessible. ctDynamic Dynamic cursor; data modifications, deletions, and insertions by other users are visible; scrolling forward and back allowed. ctStatic Static cursor; static copy of records; data changes by other users not visible; used mostly for reporting. Note: Only ctStatic is supported if the CursorLocation property of the ADO dataset component is set to clUseClient. Note: If the requested cursor type is not supported by the provider, the provider may return another cursor type. This alternate cursor type is reflected in the CursorType property after the recordset is opened. 大約看了一下,有錯請指正: ctUnspecified 不特別指定 ctOpenForwardOnly 選出來的資料表只能向前移動(next),無法往回(privor),但是效率會比較好 ctKeyset 選出的資料表,若事後被其他使用者新增的資料看不到,被其他使用者刪除的資料無法存取 ctDynamic 選出的資料表,若事後被其他使用者新增/刪除/修改的資料,會在資料移動時即時顯示出來 ctStatic 選出的資料表,若事後被其他使用者新增/刪除/修改的資料,資料移動時完全看不到 ~~~Delphi K.Top討論區站長~~~
------
~~~Delphi K.Top討論區站長~~~
領航天使
站長


發表:12216
回覆:4186
積分:4084
註冊:2001-07-25

發送簡訊給我
#3 引用回覆 回覆 發表時間:2003-07-10 23:23:44 IP:210.202.xxx.xxx 未訂閱
列出原文 TADOLockType specifies the types of locks used. Unit ADOdb type TADOLockType = (ltUnspecified, ltReadOnly, ltPessimistic, ltOptimistic, ltBatchOptimistic); Description Use TADOLockType with execution methods to specify the types of record locks used during editing. Lock type values allow you to specify whether the locking scheme used for a recordset is optimistic or pessimistic. To use a specific locking scheme, the provider and database type must support that locking scheme. Use ltUnspecified to have the provider use the default locking scheme. Use the LockType ltBatchOptimistic to open a recordset in batch update mode. In addition to use as command execution method parameters, TADOLockType values are passed as var parameters to event handlers related to execution. This value indicates the lock type already in use when the execution was initiated. The LockType parameter of the TADOConnection.OnWillExecute event is an example of this. The constants that make up the TADOLockType type correspond directly to the LockTypeEnum values with similar names. These values are discussed in the Microsoft Data Access SDK help, in the topic for the LockType property of the ADO Recordset object. See the SDK for additional information on the ADO constants and their effects. TADOLockType consists of the five constants summarized in the following table: Lock Type Meaning ltUnspecified A specific lock type has not been specified or determined. ltReadOnly Read-only; the current execution cannot modify data. ltPessimistic Pessimistic locks; locks instantiated on a record-by-record basis when edit mode is applied to a record. ltOptimistic Optimistic locks; locked are initiated on a record-by-record basis, but only when updates are applied and a record is being updated. ltBatchOptimistic Optimistic batch updates; used for batch update mode rather than immediate update mode. 大約看一下,有錯誤請指正: ltUnspecified 不特別指定 ltReadOnly 選出來的資料表只能讀,無法寫入 ltPessimistic 選出來的資料表可寫入,當該筆記錄寫入時會立刻寫入並鎖定 ltOptimistic 選出來的資料表可寫入,當該筆記錄寫入時不會立刻寫入但會鎖定,當執行updates時才正式寫入該筆記錄 ltBatchOptimistic 選出來的資料表可寫入,當該筆記錄寫入時不會立刻寫入但會鎖定,當執行updates時才正式整批寫入該筆記錄(可以修改多筆整批update) ~~~Delphi K.Top討論區站長~~~
------
~~~Delphi K.Top討論區站長~~~
cashxin2002
版主


發表:231
回覆:2555
積分:1937
註冊:2003-03-28

發送簡訊給我
#4 引用回覆 回覆 發表時間:2003-07-12 09:18:16 IP:63.84.xxx.xxx 未訂閱
謝謝天使大大﹐抽空為小弟解答﹒ 真誠感謝﹗    (被公司抓去其它城市處理一些事情﹐所以回覆慢了兩天﹐還望天使大大見諒) 努力,相信會獲得美麗! 忻晟
------
忻晟
Ivy_chen
一般會員


發表:3
回覆:5
積分:1
註冊:2003-01-15

發送簡訊給我
#5 引用回覆 回覆 發表時間:2003-12-22 12:06:41 IP:211.72.xxx.xxx 未訂閱
再請教一下,那ADOTABLE可以適用LOCKTYPE的設定嗎? 因為我設定後都沒有用! 如果有一USER修改A0001的資料(ADOTABLE1.EDIT),另一個USER還是可以把A0001的資料刪除(ADOTABLE1.DELETE) 請問這是怎麼回事呢?
系統時間:2024-03-29 21:01:58
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!