【delphi开源代码栏目提醒】:网学会员,鉴于大家对delphi开源代码十分关注,论文会员在此为大家搜集整理了“bdcxunit.pas”一文,供大家参考学习!
unit bdcxunit;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Grids, DBGrids, ExtCtrls, StdCtrls, ToolWin, ComCtrls,datadomule;
type
Tbdcx = class(TForm)
ToolBar1: TToolBar;
ComboBox1: TComboBox;
Label1: TLabel;
Edit1: TEdit;
Button1: TButton;
Panel1: TPanel;
DBGrid1: TDBGrid;
procedure Button1Click(Sender: TObject);
procedure Edit1Enter(Sender: TObject);
procedure ComboBox1Change(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
bdcx: Tbdcx;
implementation
{$R *.dfm}
procedure Tbdcx.Button1Click(Sender: TObject);
begin
if combobox1.text='按查询' then
begin
with datamodule1.qry_bdcx do
begin
close;
sql.Clear ;
sql.Add('select * from xsbd 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_bdcx do
begin
close;
sql.Clear ;
{sql.Add('select * from xsbd where bdsj like :time'); //也可以用的,等价于下面的语句
parambyname('time').AsString:=edit1.text+'%'; }
SQL.Add('select * from xsbd where bdsj like '+''''+edit1.text+'%'+'''');
open;
if recordcount=0 then
begin
application.messagebox('没有检索到信息!','提示',mb_ok+mb_iconinformation);
end;
end;
end;
end;
procedure Tbdcx.Edit1Enter(Sender: TObject);
begin
edit1.clear
end;
procedure Tbdcx.ComboBox1Change(Sender: TObject);
begin
if combobox1.text='按时间查询' then
begin
edit1.text:='请输入年份';
end;
if combobox1.text='按查询' then
begin
edit1.text:='请输入';
end;
end;
end.