⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 027.htm

📁 Delphi书籍--Delphi网上教程
💻 HTM
字号:
<HTML><HEAD><meta http-equiv="Content-Type" content="text/html; charset=GB2312"><TITLE>-->DELPHI专题文档-数据库应用-->如何 Pack dBASE资料档</TITLE>
<META NAME="keywords" CONTENT=" DELPHI专题文档-数据库应用 如何 Pack dBASE资料档">
<META NAME="description" CONTENT=" - DELPHI专题文档-数据库应用 - 如何 Pack dBASE资料档">

<style>
<!--
#page {position:absolute; z-index:0; left:0px; top:0px}
.tt3 {font: 9pt/12pt "宋体"}
.tt2 {font: 12pt/15pt "宋体"}
a {text-decoration:none}
a:hover {color: blue;text-decoration:underline}
-->
</style>
</HEAD>
<a href="index8.html">返回</a>

<body text="#000000" aLink=#9900ff link=#006699 vLink=#006699 bgcolor="#FFFFFF" leftmargin="3" topmargin="3" marginheight="3" marginwidth="3">
<TABLE WIDTH="100%" CELLPADDING=10 CELLSPACING=0 BORDER=0>
<TR>

<TD class="tt2" bgcolor="#F5F8F8" width="84%"><center><B><FONT style="FONT-SIZE: 16.5pt" COLOR="#FF6666" FACE="楷体_GB2312">如何 Pack dBASE资料档</FONT></B></center> 
<hr color="#EE9B73" size="1" width="94%"> 
<ul> 

<p><span class="font1">我从 DChat.exe 的原始程式中截出一段程式来, 
您可以参考看看其中 pack 的作法. 当时我用递回的方法, 将指定目录(含子目录)中的 
dbf 全部 pack 一遍.</span></p> 
<p><span class="font1">DChat.Exe DelphiChat 讨论资料库的原始程式您可以在<a 
href="javascript:if(confirm('http://hub.myrice.com/202.98.107.86/tyb/delphi/dbftools/cr_app.html  \n\nThis file was not retrieved by Teleport Pro, because it is linked too far away from its Starting Address. If you increase the in-domain depth setting for the Starting Address, this file will be queued for retrieval.  \n\nDo you want to open it from the server?'))window.location='http://hub.myrice.com/202.98.107.86/tyb/delphi/dbftools/cr_app.html'" tppabs="http://hub.myrice.com/202.98.107.86/tyb/delphi/dbftools/cr_app.html" 
tppabs="http://www.chih.com/delphi/cr_app.html">Delphi学习笔记(创作篇)</a>中找到</span></p> 
<pre><span class="font1">{ Delphi 1.0
uses ..., DB, DBTables, DBConsts, DbiTypes, DbiProcs, DbiErrs, ..
}
(*--------------------------------------------------*)
(* PACK 资料库
(*
(*
(*--------------------------------------------------*)
procedure TfrmMain.DoPackTable(const sCurrentPath: string);
var
SearchRec: TSearchRec;
iFindResult: integer;
tblBePack: TTable;
begin
iFindResult := FindFirst(sCurrentPath + '*.DBF', faAnyFile, SearchRec);
while iFindResult = 0 do
begin
frmWait.lblPrompt.Caption := 'Packing: ' + SearchRec.Name;
frmWait.lblPrompt.Refresh;
Application.ProcessMessages;
tblBePack := TTable.Create(Self);
Application.ProcessMessages;
with tblBePack do
begin
DatabaseName := sCurrentPath;
TableName := SearchRec.Name;
TableType := ttDBase;
Exclusive := True;
Open;
Application.ProcessMessages;
DbiPackTable(DBHandle, Handle, nil, nil, True);
Application.ProcessMessages;
Close;
Free;
end;


Application.ProcessMessages;
iFindResult := FindNext(SearchRec);
end;


(* 向下搜寻子目录 *)
iFindResult := FindFirst(sCurrentPath + '*.', faDirectory, SearchRec);
while iFindResult = 0 do
begin
Application.ProcessMessages;
if (SearchRec.Name[1] &lt;&gt; '.') and
(gsTempDir &lt;&gt; sCurrentPath + SearchRec.Name + '\') then
begin
DoPackTable(sCurrentPath + SearchRec.Name + '\');
end;
iFindResult := FindNext(SearchRec);
end;
end;</span></pre> 
</ul> 
<p> </p>
<hr color="#EE9B73" size="1" width="94%"> 
 
</TD> 
 
</TR> 
</table> 
</BODY></HTML>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -