?? mrscdd_zcx.pas
字號(hào):
unit MRSCDD_ZCX;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ComCtrls, StdCtrls, Buttons, DB, Grids, DBGrids;
type
TFRM_SCDD_ZCX = class(TForm)
GroupBox1: TGroupBox;
GroupBox2: TGroupBox;
BitBtn1: TBitBtn;
BitBtn2: TBitBtn;
RadioButton1: TRadioButton;
RadioButton2: TRadioButton;
ComboBox1: TComboBox;
ComboBox2: TComboBox;
RadioButton3: TRadioButton;
RadioButton4: TRadioButton;
RadioButton5: TRadioButton;
DateTimePicker1: TDateTimePicker;
DBGrid1: TDBGrid;
Datalb: TDataSource;
ComboBox3: TComboBox;
DateTimePicker2: TDateTimePicker;
BitBtn3: TBitBtn;
procedure FormShow(Sender: TObject);
procedure BitBtn1Click(Sender: TObject);
procedure RadioButton1Click(Sender: TObject);
procedure RadioButton2Click(Sender: TObject);
procedure RadioButton5Click(Sender: TObject);
procedure RadioButton3Click(Sender: TObject);
procedure RadioButton4Click(Sender: TObject);
procedure BitBtn3Click(Sender: TObject);
procedure BitBtn2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
FRM_SCDD_ZCX: TFRM_SCDD_ZCX;
implementation
uses MR_DATA, MRSCDD_DY;
{$R *.dfm}
procedure TFRM_SCDD_ZCX.FormShow(Sender: TObject);
begin
combobox1.Clear;
combobox2.Clear;
combobox3.Text := '';
DateTimePicker1.Date := now();
DateTimePicker2.Date := now();
with data.ADOa do
begin
close;
sql.Clear;
sql.Add('select * from tb_scdd');
open;
end;
if data.ADOa.RecordCount>0 then
begin
while not data.adoa.Eof do
begin
combobox1.Items.Add(data.ADOa.fieldbyname('scddh').AsString);
combobox2.Items.Add(data.ADOa.fieldbyname('hh').AsString);
data.ADOa.Next;
end;
end;
data.ADOa.First;
datalb.DataSet := data.ADOa;
end;
procedure TFRM_SCDD_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 := 'hh';
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_scdd where year(ktime)='+floattostr(year)+' and month(ktime)='+floattostr(month)+' and day(ktime)='+floattostr(day));
open;
end;
end;
if RadioButton4.Checked = true then
begin
s := 'll';
decodedate(DateTimePicker2.Date,year,month,day);
with data.ADOa do
begin
close;
sql.Clear;
sql.Add('select * from tb_scdd where year(wtime)='+floattostr(year)+' and month(wtime)='+floattostr(month)+' and day(wtime)='+floattostr(day));
open;
end;
end;
if RadioButton5.Checked = true then
begin
s := 'yn';
p := combobox3.Text;
end;
if s <> 'll' then
begin
if (p = '')or(p = 'aa') then
begin
showmessage('查詢(xún)條件不能為空。');
end
else
begin
with data.ADOa do
begin
close;
sql.Clear;
sql.Add('select * from tb_scdd where '+s+'='+''''+p+'''');
open;
end;
end;
end;
end;
procedure TFRM_SCDD_ZCX.RadioButton1Click(Sender: TObject);
begin
combobox2.Text := '';
combobox3.Text := '';
end;
procedure TFRM_SCDD_ZCX.RadioButton2Click(Sender: TObject);
begin
combobox1.Text := '';
combobox3.Text := '';
end;
procedure TFRM_SCDD_ZCX.RadioButton5Click(Sender: TObject);
begin
combobox2.Text := '';
combobox1.Text := '';
end;
procedure TFRM_SCDD_ZCX.RadioButton3Click(Sender: TObject);
begin
combobox1.Text := '';
combobox2.Text := '';
combobox3.Text := '';
end;
procedure TFRM_SCDD_ZCX.RadioButton4Click(Sender: TObject);
begin
combobox1.Text := '';
combobox2.Text := '';
combobox3.Text := '';
end;
procedure TFRM_SCDD_ZCX.BitBtn3Click(Sender: TObject);
begin
close;
end;
procedure TFRM_SCDD_ZCX.BitBtn2Click(Sender: TObject);
begin
APPLICATION.CreateForm(TFRM_SCDD_DY, FRM_SCDD_DY);
FRM_SCDD_DY.QuickRep1.PreviewModeless;
end;
end.
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -