線上訂房服務-台灣趴趴狗聯合訂房中心
發文 回覆 瀏覽次數:1087
推到 Plurk!
推到 Facebook!

table的recordcount

缺席
cyl
中階會員


發表:163
回覆:171
積分:66
註冊:2002-07-11

發送簡訊給我
#1 引用回覆 回覆 發表時間:2003-05-06 12:50:00 IP:61.218.xxx.xxx 未訂閱
請問我在filter有下條件去過濾資料,且cachedupdate=true 我show 出筆數 table.recordcount 就都不對,都是總筆數,請問要如何解決???
pgdennis
資深會員


發表:41
回覆:526
積分:443
註冊:2002-05-23

發送簡訊給我
#2 引用回覆 回覆 發表時間:2003-05-06 15:30:32 IP:218.163.xxx.xxx 未訂閱
可是我用Ttable,TQuery都正常,我是連oracle... table1.Filtered:=true; table1.Filter:='ACOD='+QuotedStr('A'); showmessage(inttostr(table1.RecordCount)); 永遠追不上技術更新的速度~~
------
星期一,二...無窮迴圈@@
cyl
中階會員


發表:163
回覆:171
積分:66
註冊:2002-07-11

發送簡訊給我
#3 引用回覆 回覆 發表時間:2003-05-06 15:39:20 IP:61.218.xxx.xxx 未訂閱
引言: 可是我用Ttable,TQuery都正常,我是連oracle... table1.Filtered:=true; table1.Filter:='ACOD=' QuotedStr('A'); showmessage(inttostr(table1.RecordCount)); 永遠追不上技術更新的速度~~ < face="Verdana, Arial, Helvetica"> 請問你有把CACHEDUPDATE=TRUE,而且我的Db是連Dbf,所以不行...
wnhoo
高階會員


發表:75
回覆:443
積分:198
註冊:2003-04-22

發送簡訊給我
#4 引用回覆 回覆 發表時間:2003-05-06 16:33:46 IP:61.155.xxx.xxx 未訂閱
你可以这样试验一下。在你每次操作后:    方法一 table1.UpdateMode :=upWhereAll; table1.Refresh ; showmessage(inttostr(table1.RecordCount));    方法二 table1.Active :=false; table1.Active :=true; showmessage(inttostr(table1.RecordCount));    小弟浅见,供参考!!!    风花雪月 e梦情缘
------
风花雪月 e梦情缘
tech_state
版主


發表:44
回覆:638
積分:641
註冊:2003-02-10

發送簡訊給我
#5 引用回覆 回覆 發表時間:2003-05-06 17:13:12 IP:61.221.xxx.xxx 未訂閱
引言:
引言: 可是我用Ttable,TQuery都正常,我是連oracle... table1.Filtered:=true; table1.Filter:='ACOD=' QuotedStr('A'); showmessage(inttostr(table1.RecordCount)); 永遠追不上技術更新的速度~~ < face="Verdana, Arial, Helvetica"> 請問你有把CACHEDUPDATE=TRUE,而且我的Db是連Dbf,所以不行...
cyl, 您好 由help檔得知 CachedUpdates enables or disables the use of cached updates for a dataset. If CachedUpdates is true, cached updates are enabled. If CachedUpdates is false, cached updates are disabled. When cached updates are enabled, updates to a dataset (such as posting changes, inserting new records, or deleting records), are stored in an internal cache on the client machine instead of being written directly to the dataset's underlying database tables. When changes are complete, an application writes all cached changes to the database in the context of a single transaction. 意思是說只要設定cachedupdate=true 所有資料庫變更都會先存在client machine 除非將變更update到database 才會查詢到新的資料 因此才會Show出來的table.recordcount 就都不對 如同wnhoo提出的方法, 如果是用TDBGrid來顯示的話, 確實可以看到過濾後的資料, 但是實際的table.recordcount 仍舊是不變的, 還是過濾前的table.recordcount。 以上想法,若有錯誤請指正。 ======================= 是非終日有,不聽自然無 天下本無事,庸人自擾之
pgdennis
資深會員


發表:41
回覆:526
積分:443
註冊:2002-05-23

發送簡訊給我
#6 引用回覆 回覆 發表時間:2003-05-06 22:52:25 IP:61.59.xxx.xxx 未訂閱
引言:
引言: 可是我用Ttable,TQuery都正常,我是連oracle... table1.Filtered:=true; table1.Filter:='ACOD=' QuotedStr('A'); showmessage(inttostr(table1.RecordCount)); 永遠追不上技術更新的速度~~ < face="Verdana, Arial, Helvetica"> 請問你有把CACHEDUPDATE=TRUE,而且我的Db是連Dbf,所以不行...
我想你是不是不想要重新query的情形下,用filter的方法過濾資料,,,, 而你又需要CACHEDUPDATE=TRUE...我想你是不是在filter時先將CACHEDUPDATE=false..反正這時你是查詢資料,沒有修改資料...如
 
Query1.CachedUpdates:=false;
Query1.Filtered:=true;
Query1.Filter:='MONTH=10';
showmessage(inttostr(Query1.RecordCount));
Query1.CachedUpdates:=true;
這樣...就可以正常顯示筆數了.. 永遠追不上技術更新的速度~~
------
星期一,二...無窮迴圈@@
wnhoo
高階會員


發表:75
回覆:443
積分:198
註冊:2003-04-22

發送簡訊給我
#7 引用回覆 回覆 發表時間:2003-05-07 09:24:09 IP:61.155.xxx.xxx 未訂閱
.....//~~~~~~~~~ table1.Active :=true; table1.CachedUpdates :=false; .....//相关数据操作 table1.Refresh; table1.CachedUpdates :=true; {可选} //table1.Active :=false //table1.Active :=true; showmessage(inttostr(table1.RecordCount));    风花雪月 e梦情缘
------
风花雪月 e梦情缘
系統時間:2024-06-29 18:34:01
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!