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

📄 frmqtmb.pas

📁 delphi+excel报表管理程序
💻 PAS
字号:
unit frmqtmb;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, ExtCtrls;

type
  TForm5 = class(TForm)
    Panel1: TPanel;
    Label1: TLabel;
    RadioButton1: TRadioButton;
    RadioButton2: TRadioButton;
    ComboBox1: TComboBox;
    Button1: TButton;
    procedure ComboBox1Select(Sender: TObject);
    procedure Button1Click(Sender: TObject);
    procedure FormShow(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form5: TForm5;

implementation

uses frmmain;

{$R *.dfm}

procedure TForm5.ComboBox1Select(Sender: TObject);
begin
form1.ADOQuery1.Close;
form1.ADOQuery1.SQL.Clear;
form1.ADOQuery1.SQL.Add('select * from template');
form1.ADOQuery1.SQL.Add('where name=:a1');
form1.adoquery1.Parameters.ParamValues['a1']:=trim(ComboBox1.Text);
form1.ADOQuery1.Open;
if (form1.ADOQuery1.Fields.Fields[4].AsString='1') then
   RadioButton1.Checked:=true
else
   RadioButton2.Checked:=true;
end;

procedure TForm5.Button1Click(Sender: TObject);
begin
form1.ADOQuery1.Close;
form1.ADOQuery1.SQL.Clear;
form1.ADOQuery1.SQL.Add('select * from template');
form1.ADOQuery1.SQL.Add('where name=:a1');
form1.adoquery1.Parameters.ParamValues['a1']:=trim(ComboBox1.Text);
form1.ADOQuery1.Open;
form1.ADOQuery1.Edit;
if RadioButton1.Checked=true then
  begin
  form1.adoquery1.FieldByName('flag2').AsString:=trim('1');
  form1.ADOQuery1.Post;
  application.MessageBox('模板已经启用!','系统提示');
  end;
if RadioButton2.Checked=true then
  begin
  form1.adoquery1.FieldByName('flag2').AsString:=trim('0');
  form1.ADOQuery1.Post;
  application.MessageBox('模板已经停用!','系统提示');
  end;
end;

procedure TForm5.FormShow(Sender: TObject);
var
i:integer;
j:integer;
begin
//更新报表类型列表
try
form1.ADOQuery1.Close;
form1.ADOQuery1.SQL.Clear;
form1.ADOQuery1.SQL.Add('select * from template');
form1.ADOQuery1.Open;
i:=form1.ADOQuery1.RecordCount;
ComboBox1.Clear;
for j := 1 to i do
begin
form1.ADOQuery1.Close;
form1.ADOQuery1.SQL.Clear;
form1.ADOQuery1.SQL.Add('select * from template');
form1.ADOQuery1.SQL.Add('where id=:a1');
form1.adoquery1.Parameters.ParamValues['a1']:=inttostr(j);
form1.ADOQuery1.Open;
if (form1.ADOQuery1.Fields.Fields[3].AsString='1') then
ComboBox1.Items.Add(form1.ADOQuery1.Fields.Fields[1].AsString);
end;
except;
end;
//更新报表类型列表结束
end;

end.

⌨️ 快捷键说明

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