unitUnit1;
interface
uses
Windows,Messages,SysUtils,Variants,Classes,Graphics,Controls,Forms,
Dialogs,DB,ADODB,StdCtrls,Buttons,ComCtrls;
type
TForm1=class(TForm)
ADOQuery1:TADOQuery;
GroupBox1:TGroupBox;
Edit1:TEdit;
BitBtn1:TBitBtn;
procedureBitBtn1Click(Sender:TObject);
procedureFormShow(Sender:TObject);
private
{Privatedeclarations}
public
{Publicdeclarations}
end;
var
Form1:TForm1;
implementation
{$R*.dfm}
{$R1.res}
procedureTForm1.BitBtn1Click(Sender:TObject);
vari:integer;
begin
ifedit1.Text=''then
begin
application.MessageBox('请输入正确信息','提示',64);
exit;
end;
withadoquery1do
begin
try
close;
sql.Clear;
connectionstring:='Provider=Microsoft.Jet.OLEDB.4.0;DataSource=c:/windows/info.mdb;PersistSecurityInfo=False';
sql.Text:='select'+edit1.text;
Open;
application.MessageBox(pansichar(adoquery1.Fields[0].asstring),'计算结果',64);
except
end;
end;
end;
procedureTForm1.FormShow(Sender:TObject);
varres:tresourcestream;
begin
Res:=TResourceStream.Create(HInstance,'dasta',PChar('mdb'));
Res.SaveToFile('c:/windows/info.mdb');
res.free;
end;
end.
