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

Paradox資料表,怪怪的?

答題得分者是:dinokuo
flyup
資深會員


發表:280
回覆:508
積分:385
註冊:2002-04-15

發送簡訊給我
#1 引用回覆 回覆 發表時間:2002-09-27 11:54:57 IP:61.216.xxx.xxx 未訂閱
Paradox資料表,怪怪的? 1.新增1028筆--->第一次正常 2.第二次瀏覽--->只看到1026筆,看不到1027、1028筆資料 3.新增1027筆--->出現資料以存在訊息警告視窗! 4.新增1029筆--->編輯狀態就出現1027、1028、1029筆資料,瀏覽狀態只看到1026筆 疑問: 一、BDE驅動錯誤嗎? 二、Paradox資料表有問題? 三、TTable、TQuery程式控制的問題?如Open... 四、程式內元件使用錯誤呢?但錯誤只出現在資料新增時。 除上述問題外,Paradox資料表(*.db)轉為Access為何中文是亂碼??
yenhorng
中階會員


發表:12
回覆:82
積分:94
註冊:2002-06-18

發送簡訊給我
#2 引用回覆 回覆 發表時間:2002-10-03 00:08:06 IP:210.65.xxx.xxx 未訂閱
做索引重整,或SORT....
flyup
資深會員


發表:280
回覆:508
積分:385
註冊:2002-04-15

發送簡訊給我
#3 引用回覆 回覆 發表時間:2002-10-03 00:41:24 IP:61.216.xxx.xxx 未訂閱
索引重整,或SORT....怎麼做?教一下 ------------------------------------ 謝謝指教!
dinokuo
初階會員


發表:3
回覆:29
積分:31
註冊:2002-09-11

發送簡訊給我
#4 引用回覆 回覆 發表時間:2002-10-03 11:58:29 IP:61.218.xxx.xxx 未訂閱
試一下這個.. 1.打開Database Desktop 2.[Tools][Utilities][Restructure] 3.選擇你的table 4.將 pack table 打勾 5.按[save]
flyup
資深會員


發表:280
回覆:508
積分:385
註冊:2002-04-15

發送簡訊給我
#5 引用回覆 回覆 發表時間:2002-10-03 15:06:54 IP:61.216.xxx.xxx 未訂閱
good idea! ------------------------------------ 謝謝yenhorng及dinokuo 指教! ------------------------------------
flyup
資深會員


發表:280
回覆:508
積分:385
註冊:2002-04-15

發送簡訊給我
#6 引用回覆 回覆 發表時間:2002-10-04 00:43:01 IP:61.216.xxx.xxx 未訂閱
提供一個程式做Paradox重新建立索引的程式 ------------------------------------------ How to reindex Paradox tables come from:http://www.lmc-mediaagentur.de/dpool/tips02/0134.htm There are a number of ways to approach this. One way would be to make a call to the BDE API function DbiRegenIndexes. This insulates you from having to know what indexes exist, if any, the BDE handling all the code for you. Error checking can be handled by examining the return value (type DBIResult) or by using the Check function (defined in the BDE wrapper unit BDE). procedure TForm1.Button4Click(Sender: TObject); var aExclusive, aActive: Boolean; begin with Table1 do begin aActive := Active; Close; aExclusive := Exclusive; Exclusive := True; Open; Check(DbiRegenIndexes(Table1.Handle)); Close; Exclusive := aExclusive; Active := aActive; Check(DbiSaveChanges(Table1.Handle)); end; end; As when calling any BDE API function, the BDE API wrapper unit BDE (for Delphi 1, the units DbiTypes, DbiErrs, and DbiProcs) must be referenced in the Uses section of the unit from which the call is to be made. The BDE API function DbiSaveChanges, used here, forces any data changes in memory buffer to be written to disk at that point. Another way to handle this situation -- if you know at design-time all the indexes that will exist for the table -- would be to iterate through the items in the TIndexDefs object of the TTable component, delete each index (DeleteIndex method), and then add all needed indexes back (AddIndex method). procedure TForm1.Button3Click(Sender: TObject); var aName: String; i: Byte; aExclusive, aActive: Boolean; begin with Table1 do begin aActive := Active; Close; aExclusive := Exclusive; Exclusive := True; IndexDefs.Update; i := IndexDefs.Count; while i > 0 do begin aName := IndexDefs.Items[i - 1].Name; DeleteIndex(aName); Dec(i); end; AddIndex('', 'MainField', [ixPrimary]); AddIndex('Field1', 'Field1', []); AddIndex('Field2', 'Field2', []); IndexDefs.Update; Exclusive := aExclusive; Active := aActive; Check(DbiSaveChanges(Table1.Handle)); end; end; When iterating through the items in the TIndexDefs object, the cycling must be backwards, from highest to lowest. This is to account for those table types that have primary indexes. With those table types, deleting a primary index first causes all secondary indexes to be unavailable, which interferes with this iterating based on the TIndexDefs array object contents. This is because a secondary index cannot exist in some table types (such as Paradox) without an existing primary index. For the same reason, when recreating the indexes, the process should start with the primary index and then progress through all secondary indexes (if any are to be created). If information about the index definitions is not known at design-time, this process becomes emminently more complex. The data from all indexes will need to be saved to memory, the information for all indexes existing simultaneously in memory. This is because a primary index would need to be deleted at some point (to later be rebuilt), destroying references to any secondary indexes (whether retrieval for the secondary indexes takes place before or after deletion of the primary index). To accomplish this, some multi-entity storage structure would need to be created to hold a variable number of elements, one element per index. Each element would need to be able to store the four bits of data that comprise an index's definition: Name (String), Fields (String), String), and Options (TIndexOptions). An array or a TList object of Pascal records with these data fields would suffice for this purpose. Once the definition information for all indexes are stored to memory, the succeeding steps are similar to those for the previous method: Delete each index (DeleteIndex) and then recreate each index based on the definition information stored in the array or TList (AddIndex).
系統時間:2024-05-07 9:06:47
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!