📄 uform_bt_output.pas
字号:
unit Uform_bt_output;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ComCtrls, StdCtrls, Buttons, ExtCtrls, ImgList, DB, ADODB;
type
Tform_bt_output = class(TForm)
Panel1: TPanel;
Image1: TImage;
Bevel2: TBevel;
Bevel3: TBevel;
Image2: TImage;
Label1: TLabel;
Panel2: TPanel;
Panel3: TPanel;
Panel4: TPanel;
BitBtn1: TBitBtn;
BitBtn2: TBitBtn;
BitBtn3: TBitBtn;
ListView2: TListView;
Label2: TLabel;
Label3: TLabel;
recordset_temp: TADOQuery;
ImageList1: TImageList;
SaveDialog1: TSaveDialog;
procedure BitBtn2Click(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure BitBtn3Click(Sender: TObject);
procedure BitBtn1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
delsqlstring:string;
int_listcount:integer;
end;
var
form_bt_output: Tform_bt_output;
implementation
uses Uform_edit_d1;
{$R *.dfm}
procedure Tform_bt_output.BitBtn2Click(Sender: TObject);
var
sqlstr:string;
p:^integer;
i:integer;
ListItem: TListItem;
begin
{*查询限定窗体的初始化*}
form_edit_d1.SpinEdit1.Value :=0;
form_edit_d1.SpinEdit2.Value :=0 ;
form_edit_d1.SpinEdit3.Value :=0 ;;
form_edit_d1.CheckBox1.Checked :=false;
form_edit_d1.RadioButton1.Checked :=true;
form_edit_d1.RadioButton1.Enabled :=false;
form_edit_d1.RadioButton2.Enabled :=false;
{*查询限定窗体的显示*}
form_edit_d1.ShowModal ;
if form_edit_d1.yesno =false then exit;
{*建立SQL语句*}
sqlstr:='select * from [CODE] where [CODE_KIND]=' + inttostr(form_edit_d1.k_code)
+ ' and [CODE_ONE]>=' + inttostr(form_edit_d1.s_code) + ' and [CODE_ONE]<='
+ inttostr(form_edit_d1.e_code) ;
delsqlstring:=' [CODE_KIND]=' + inttostr(form_edit_d1.k_code)
+ ' and [CODE_ONE]>=' + inttostr(form_edit_d1.s_code) + ' and [CODE_ONE]<='
+ inttostr(form_edit_d1.e_code);
if form_edit_d1.c_code =1 then
begin
sqlstr:=sqlstr+ ' and [CODE_CHECK]=true';
delsqlstring:=delsqlstring+' and [CODE_CHECK]=true';
end;
if form_edit_d1.c_code =2 then
begin
sqlstr:=sqlstr+ ' and [CODE_CHECK]=false';
delsqlstring:=delsqlstring+' and [CODE_CHECK]=false';
end;
{*建立查询*}
recordset_temp.SQL.Clear ;
recordset_temp.SQL.Add(sqlstr + ' order by [CODE_ONE]' );
recordset_temp.Open ;
{*填充listview*}
listview2.Clear;
int_listcount:=recordset_temp.RecordCount ;
label3.Caption :=inttostr(recordset_temp.RecordCount )+ '个';
for i:=1 to recordset_temp.RecordCount do
begin
listitem:=listview2.Items.Add ;
listitem.Caption :=inttostr(recordset_temp.Fields[1].AsInteger );
listitem.SubItems.Add(inttostr(recordset_temp.Fields[2].asinteger));
listitem.SubItems.Add (recordset_temp.Fields [3].AsString );
new(p);
p^ := recordset_temp.Fields[0].AsInteger ;
listitem.Data :=p;
if recordset_temp.Fields[4].AsBoolean =true then
begin
listitem.SubItems.Add('是');
listitem.SubItems.Add (datetimetostr(recordset_temp.Fields [5].AsDateTime ));
listitem.ImageIndex :=0;
end
else
begin
listitem.SubItems.Add('否');
listitem.ImageIndex :=1;
end;
recordset_temp.Next;
end;
recordset_temp.Close ;
end;
procedure Tform_bt_output.FormShow(Sender: TObject);
begin
//show the form delete the list item 2001-12-19
listview2.Clear ;
end;
procedure Tform_bt_output.BitBtn3Click(Sender: TObject);
begin
//close the form 2001-12-19
close;
end;
procedure Tform_bt_output.BitBtn1Click(Sender: TObject);
var
filevar: textfile;
i:integer;
temp:string;
begin
//create a new text file and output the code to it 2001-12-19
//create a new text file
if not savedialog1.Execute then exit ;
if fileexists(savedialog1.FileName + '.txt' )=true then
begin
showmessage('已有此文件,请创建一个新文件!');
exit;
end;
assignfile(filevar,savedialog1.FileName +'.txt');
Rewrite(filevar);
//showmessage('select * from [CODE] where ' + delsqlstring + ' order [CODE_ONE');
recordset_temp.SQL.Clear ;
recordset_temp.SQL.Add('select * from [CODE] where ' + delsqlstring + ' order by [CODE_ONE]');
recordset_temp.Open ;
for i :=1 to recordset_temp.RecordCount do
begin
writeln (filevar, recordset_temp.fields[3].asstring );
recordset_temp.next;
end;
recordset_temp.Close;
closefile(filevar);
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -