【delphi开源代码栏目提醒】:网学会员在delphi开源代码频道为大家收集整理了jlcxunit.pas提供大家参考,希望对大家有所帮助!
unit jlcxunit;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Grids, DBGrids, ExtCtrls, StdCtrls, ToolWin, ComCtrls;
type
Tjlcx = class(TForm)
Panel1: TPanel;
DBGrid1: TDBGrid;
ToolBar1: TToolBar;
ComboBox1: TComboBox;
Label1: TLabel;
Edit1: TEdit;
Button1: TButton;
procedure Button1Click(Sender: TObject);
procedure ComboBox1Change(Sender: TObject);
procedure Edit1Enter(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
jlcx: Tjlcx;
implementation
uses datadomule;
{$R *.dfm}
procedure Tjlcx.Button1Click(Sender: TObject);
begin
if combobox1.text='按查询' then
begin
with datamodule1.qry_jlcx do
begin
close;
sql.Clear;
sql.Add('select * from viewjlcx where xsxh_id=:id');
parambyname('id').asstring:=edit1.text;
open;
if recordcount=0 then
begin
application.MessageBox('没有该学生的惩处记录','提示',mb_ok+mb_iconinformation);
end;
end;
end;
if combobox1.text='按时间查询' then
begin
with datamodule1.qry_jlcx do
begin
close;
sql.Clear;
sql.Add('select * from viewjlcx where sj00 like :id');
parambyname('id').asstring:=edit1.text+'%';
open;
if recordcount=0 then
begin
application.MessageBox('没有检索到惩处记录','提示',mb_ok+mb_iconinformation);
end;
end;
end;
end;
procedure Tjlcx.ComboBox1Change(Sender: TObject);
begin
if combobox1.text='按时间
查询' then
begin
edit1.text:='请输入年份';
end;
if combobox1.text='按查询' then
begin
edit1.text:='请输入';
end;
end;
procedure Tjlcx.Edit1Enter(Sender: TObject);
begin
edit1.Clear ;
end;
end.