You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

101 lines
2.3 KiB
Plaintext

11 months ago
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
ppEndUsr, ppProd, ppClass, ppReport, ppComm, ppRelatv, ppCache, ppDB,
ppDBPipe, Db, ADODB, StdCtrls, Grids, DBGrids, CheckLst,ShellApi;
type
TForm1 = class(TForm)
CheckListBox1: TCheckListBox;
Button1: TButton;
Button2: TButton;
DBGrid1: TDBGrid;
Button3: TButton;
Label1: TLabel;
Edit1: TEdit;
Edit2: TEdit;
Label2: TLabel;
Button4: TButton;
Button5: TButton;
db_old: TADOConnection;
ADOQuery1: TADOQuery;
DataSource1: TDataSource;
ppDBPipeline1: TppDBPipeline;
ppReport1: TppReport;
ppDesigner1: TppDesigner;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure Button5Click(Sender: TObject);
procedure Button4Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.Button1Click(Sender: TObject);
begin
ShellExecute(Application.Handle,nil,PChar(ExtractFilePath(Application.ExeName)+'\sql.udl'),nil,nil,SW_NORMAL);
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
try
db_old.ConnectionString:='FILE NAME='+ExtractFilePath(ParamStr(0))+'sql.udl';
db_old.Connected:=true;
except
showmessage('<27><><EFBFBD>ݿ<EFBFBD><DDBF><EFBFBD><EFBFBD>Ӵ<EFBFBD><D3B4><EFBFBD><EFBFBD><EFBFBD>');
exit;
end;
db_old.GetTableNames(CheckListBox1.Items);
end;
procedure TForm1.Button3Click(Sender: TObject);
begin
if CheckListBox1.Items.Count<1 then
exit;
ADOQuery1.Close;
ADOQuery1.SQL.text:='select * from '+CheckListBox1.Items[CheckListBox1.ItemIndex];
ADOQuery1.open;
end;
procedure TForm1.Button5Click(Sender: TObject);
begin
close;
end;
procedure TForm1.Button4Click(Sender: TObject);
begin
if ADOQuery1.isempty then
exit;
if ADOQuery1.isempty then
begin
showmessage('û<><C3BB>Ҫ<EFBFBD><D2AA><EFBFBD>Ƶĸ<C6B5>ʽ<EFBFBD><CABD>');
exit;
end;
ppReport1.template.DatabaseSettings.NameField:=edit1.text;
ppReport1.template.DatabaseSettings.TemplateField:=edit2.text;
try
ppReport1.template.DatabaseSettings.Name:=ADOQuery1.fieldbyname(Edit1.text).AsString;
ppReport1.template.LoadFromDatabase;
ppReport1.AllowPrintToFile:=true;
ppDesigner1.ShowModal;
except
showmessage('<27><>ʽ<EFBFBD><CABD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>');
end;
end;
end.