自己对DELPHI学习的一点体会
源代码在线查看: 使用bdeapi实现查询结果的物理存储 (2001年3月13.txt
使用BDEAPI实现查询结果的物理存储 (2001年3月13日)
网友更新 分类:数据库 作者:阎磊 推荐:yanlei 阅读次数:267
(http://www.codesky.net)
--------------------------------------------------------------------------------
在form1上放一个query1,设databasename=DBDEMOS,sql.Tstring为select * from country
放两个按钮button1,button2
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
Db,BDE, StdCtrls, DBTables;
type
TForm1 = class(TForm)
query1: TQuery;
Button1: TButton;
Button2: TButton;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.Button1Click(Sender: TObject);
var
hd: HDBICur;
ph : PHDBICur;
begin
query1.Prepare;
Check(dbiQExec(query1.StmtHandle, ph));
hd:= ph^;
Check(DbiMakePermanent(hd, Pchar(ExtractFilePath(Application.ExeName)+'q1.db'), True));
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
Application.Terminate;
end;
end.