?? unit6.pas
字號:
unit Unit6;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls, Grids, DBGrids, DB, DBTables;
type
TForm6 = class(TForm)
Query1: TQuery;
DataSource1: TDataSource;
DBGrid1: TDBGrid;
RG: TRadioGroup;
Edit1: TEdit;
Button1: TButton;
Button2: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form6: TForm6;
implementation
{$R *.dfm}
procedure TForm6.Button1Click(Sender: TObject);
begin
case rg.ItemIndex of
0:begin
if length(trim(edit1.Text ))=0 then
begin
messagedlg('沒有輸入商品名稱,重新輸入',mterror,[mbok],0);
edit1.SetFocus ;
exit;
end;
with query1 do
begin
close;
sql.Clear ;
sql.Add('select * from 入庫單 ');
sql.Add('where 商品名稱=:id');
parambyname('id').AsString :=trim(edit1.Text );
open;
if recordcount>0 then
dbgrid1.Enabled :=true
else
begin
messagedlg('所要查找的商品并不存在,請您重新核對',mtinformation,[mbok],0);
dbgrid1.Enabled :=false;
end;
end;
end;
1:begin
if length(trim(edit1.Text ))=0 then
begin
messagedlg('沒有輸入入庫日期,重新輸入',mterror,[mbok],0);
edit1.SetFocus ;
exit;
end;
with query1 do
begin
close;
sql.Clear ;
sql.add( 'select * from 入庫單 ');
sql.Add(' where 入庫日期=:rq');
parambyname('rq').Value :=strtodate(edit1.Text );
open;
if recordcount>0 then
dbgrid1.Enabled :=true
else
begin
messagedlg('所要查找的商品并不存在,請您重新核對',mtinformation,[mbok],0);
dbgrid1.Enabled :=false;
end;
end;
end;
end;
end;
end.
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -