【delphi开源代码栏目提醒】:网学会员在delphi开源代码频道为大家收集整理了MRCPCL_CX.pas提供大家参考,希望对大家有所帮助!
unit MRCPCL_CX;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Buttons;
type
TFRM_CPCL_CX = class(TForm)
GroupBox1: TGroupBox;
BitBtn1: TBitBtn;
BitBtn2: TBitBtn;
Label1: TLabel;
ComboBox1: TComboBox;
procedure FormShow(Sender: TObject);
procedure BitBtn1Click(Sender: TObject);
procedure BitBtn2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
FRM_CPCL_CX: TFRM_CPCL_CX;
implementation
USES MR_DATA, MRCPCL;
{$R *.dfm}
procedure TFRM_CPCL_CX.FormShow(Sender: TObject);
begin
combobox1.Clear;
with data.ADOD do
begin
close;
sql.Clear;
sql.Add('select distinct cpmc from tb_cpcl');
open;
end;
if data.ADOD.RecordCount>0 then
begin
while not data.adoD.Eof do
begin
combobox1.Items.Add(Trim(data.ADOD.fieldbyname('cpmc').AsString));
data.ADOD.Next;
end;
end;
end;
procedure TFRM_CPCL_CX.BitBtn1Click(Sender: TObject);
begin
if combobox1.Text = '' then
begin
showmessage('请选择查询条件。');
end
else
begin
with data.ADOa do
begin
close;
sql.Clear;
sql.Add('select * from tb_cpcl where cpmc='+''''+combobox1.Text+'''');
open;
end;
if data.ADOa.RecordCount>0 then
begin
FRM_CPCL.edit1.Text := data.ADOa.fieldbyname('cpbh').AsString;
FRM_CPCL.edit2.Text := data.ADOa.fieldbyname('cpmc').AsString;
FRM_CPCL.combobox1.Text := data.ADOa.fieldbyname('clhh').AsString;
FRM_CPCL.edit3.Text := data.ADOa.fieldbyname('clmc').AsString;
FRM_CPCL.edit4.Text := data.ADOa.fieldbyname('dw').AsString;
FRM_CPCL.edit5.Text := data.ADOa.fieldbyname('gg').AsString;
FRM_CPCL.edit6.Text := floattostr(data.ADOa.fieldbyname('yl').AsFloat);
FRM_CPCL.ToolButton8.Enabled := true;
FRM_CPCL.ToolButton9.Enabled := true;
FRM_CPCL.ToolButton10.Enabled := true;
FRM_CPCL.ToolButton11.Enabled := true;
end
else
begin
FRM_CPCL.edit1.Text := '';
FRM_CPCL.edit2.Text := '';
FRM_CPCL.combobox1.Text := '';
FRM_CPCL.edit3.Text := '';
FRM_CPCL.edit4.Text := '';
FRM_CPCL.edit5.Text := '';
FRM_CPCL.edit6.Text := '';
FRM_CPCL.ToolButton8.Enabled := false;
FRM_CPCL.ToolButton9.Enabled := false;
FRM_CPCL.ToolButton10.Enabled := false;
FRM_CPCL.ToolButton11.Enabled := false;
end;
end;
end;
procedure TFRM_CPCL_CX.BitBtn2Click(Sender: TObject);
begin
close;
end;
end.