【delphi开源代码栏目提醒】:网学会员delphi开源代码为您提供MRJY_ZCX.pas参考,解决您在MRJY_ZCX.pas学习中工作中的难题,参考学习。
unit MRJY_ZCX;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Grids, DBGrids, DB, StdCtrls, Buttons, ComCtrls;
type
TFRM_JY_ZCX = class(TForm)
GroupBox1: TGroupBox;
RadioButton1: TRadioButton;
RadioButton2: TRadioButton;
ComboBox1: TComboBox;
GroupBox2: TGroupBox;
BitBtn1: TBitBtn;
BitBtn2: TBitBtn;
BitBtn3: TBitBtn;
Datalb: TDataSource;
DBGrid1: TDBGrid;
ComboBox2: TComboBox;
RadioButton3: TRadioButton;
DateTimePicker1: TDateTimePicker;
procedure FormShow(Sender: TObject);
procedure BitBtn1Click(Sender: TObject);
procedure RadioButton1Click(Sender: TObject);
procedure RadioButton2Click(Sender: TObject);
procedure RadioButton3Click(Sender: TObject);
procedure BitBtn3Click(Sender: TObject);
procedure BitBtn2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
FRM_JY_ZCX: TFRM_JY_ZCX;
implementation
uses MR_DATA, MRJY_DY;
{$R *.dfm}
procedure TFRM_JY_ZCX.FormShow(Sender: TObject);
begin
combobox1.Clear;
combobox2.Text := '';
DateTimePicker1.Date := now();
with data.ADOc do
begin
close;
sql.Clear;
sql.Add('select * from tb_jy');
open;
end;
if data.ADOc.RecordCount>0 then
begin
while not data.ADOc.Eof do
begin
combobox1.Items.Add(data.ADOc.fieldbyname('scddh').AsString);
data.ADOc.Next;
end;
end;
with data.ADOa do
begin
close;
sql.Clear;
sql.Add('select * from tb_jy');
open;
end;
end;
procedure TFRM_JY_ZCX.BitBtn1Click(Sender: TObject);
var
s,p : string;
year,month,day :
word;
begin
p := 'aa';
if RadioButton1.Checked = true then
begin
s := 'scddh';
p := combobox1.Text;
end;
if RadioButton2.Checked = true then
begin
s := 'jylx';
p := combobox2.Text;
end;
if RadioButton3.Checked = true then
begin
s := 'll';
decodedate(DateTimePicker1.Date,year,month,day);
with data.ADOa do
begin
close;
sql.Clear;
sql.Add('select * from tb_jy where year(jytime)='+floattostr(year)+' and month(jytime)='+floattostr(month)+' and day(jytime)='+floattostr(day));
open;
end;
end;
if s <> 'll' then
begin
if (p = '')or(p = 'aa') then
begin
showmessage('
查询条件不能为空。');
end
else
begin
with data.ADOa do
begin
close;
sql.Clear;
sql.Add('select * from tb_jy where '+s+'='+''''+p+'''');
open;
end;
end;
end;
end;
procedure TFRM_JY_ZCX.RadioButton1Click(Sender: TObject);
begin
combobox2.Text := '';
end;
procedure TFRM_JY_ZCX.RadioButton2Click(Sender: TObject);
begin
combobox1.Text := '';
end;
procedure TFRM_JY_ZCX.RadioButton3Click(Sender: TObject);
begin
combobox1.Text := '';
combobox2.Text := '';
end;
procedure TFRM_JY_ZCX.BitBtn3Click(Sender: TObject);
begin
close;
end;
procedure TFRM_JY_ZCX.BitBtn2Click(Sender: TObject);
begin
Application.CreateForm(TFRM_jy_dy, FRM_JY_DY);
FRM_JY_DY.QuickRep1.PreviewModal;
end;
end.