?? supply.~pas
字號:
unit supply;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Menus, Grids, ExtCtrls, ComCtrls, ToolWin, DBGrids, StdCtrls,
Buttons, DB, ADODB;
type
TFormsupply = class(TForm)
MainMenu1: TMainMenu;
Q1: TMenuItem;
PageControl1: TPageControl;
TabSheet1: TTabSheet;
TabSheet2: TTabSheet;
StringGrid1: TStringGrid;
Panel1: TPanel;
DBGrid1: TDBGrid;
ToolBar1: TToolBar;
BitBtn1: TBitBtn;
BitBtn2: TBitBtn;
BitBtn3: TBitBtn;
BitBtn4: TBitBtn;
BitBtn5: TBitBtn;
BitBtn6: TBitBtn;
BitBtn7: TBitBtn;
Edit1: TEdit;
Button1: TButton;
Edit2: TEdit;
Button2: TButton;
Edit3: TEdit;
Button3: TButton;
ADOQuery1: TADOQuery;
DataSource1: TDataSource;
procedure FormShow(Sender: TObject);
procedure Q1Click(Sender: TObject);
procedure BitBtn7Click(Sender: TObject);
procedure BitBtn1Click(Sender: TObject);
procedure BitBtn2Click(Sender: TObject);
procedure BitBtn3Click(Sender: TObject);
procedure BitBtn4Click(Sender: TObject);
procedure BitBtn5Click(Sender: TObject);
procedure BitBtn6Click(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Formsupply: TFormsupply;
implementation
uses datamodel;
{$R *.dfm}
procedure TFormsupply.FormShow(Sender: TObject);
begin
stringgrid1.Cells[0,0]:='供應商編號';
stringgrid1.Cells[1,0]:='供應商名稱';
stringgrid1.Cells[2,0]:='聯系人';
stringgrid1.Cells[3,0]:='電話';
stringgrid1.Cells[4,0]:='傳真';
stringgrid1.Cells[5,0]:='地址';
stringgrid1.Cells[6,0]:='開戶行';
stringgrid1.Cells[7,0]:='銀行帳號';
stringgrid1.Cells[8,0]:='信譽';
stringgrid1.Cells[9,0]:='等級';
end;
procedure TFormsupply.Q1Click(Sender: TObject);
begin
close;
end;
procedure TFormsupply.BitBtn7Click(Sender: TObject);
begin
ADOQuery1.Close;
ADOQuery1.SQL.Clear;
ADOQuery1.SQL.Add('select * from 供應商');
ADOQuery1.Open;
end;
procedure TFormsupply.BitBtn1Click(Sender: TObject);
begin
DataSource1.DataSet.First;
end;
procedure TFormsupply.BitBtn2Click(Sender: TObject);
begin
DataSource1.DataSet.Prior;
end;
procedure TFormsupply.BitBtn3Click(Sender: TObject);
begin
DataSource1.DataSet.Next;
end;
procedure TFormsupply.BitBtn4Click(Sender: TObject);
begin
DataSource1.DataSet.Last;
end;
procedure TFormsupply.BitBtn5Click(Sender: TObject);
begin
DataSource1.DataSet.Insert;
end;
procedure TFormsupply.BitBtn6Click(Sender: TObject);
begin
DataSource1.DataSet.Delete;
end;
procedure TFormsupply.Button1Click(Sender: TObject);
var
i,j:integer;
begin
if edit1.Text<>'' then
ADOQuery1.Close;
ADOQuery1.SQL.Clear;
ADOQuery1.SQL.Add('select * from 供應商 where 公司名稱 like ''%'+edit1.Text+'%''');
ADOQuery1.Open;
for i:=1 to 100 do
for j:=0 to 100 do
stringgrid1.Cells[i,j]:='';
i:=1;
// recordnum:=0;
while not ADOQuery1.Eof do
begin
//設置列寬
stringgrid1.ColWidths[0]:=32;
stringgrid1.ColWidths[2]:=128;
stringgrid1.ColWidths[4]:=128;
stringgrid1.ColWidths[7]:=128;
stringgrid1.ColWidths[9]:=128;
//----顯示查詢-------////
stringgrid1.Cells[0,0]:='供應商編號';
stringgrid1.Cells[1,0]:='供應商名稱';
stringgrid1.Cells[2,0]:='聯系人';
stringgrid1.Cells[3,0]:='地址';
stringgrid1.Cells[4,0]:='電話';
stringgrid1.Cells[5,0]:='傳真';
stringgrid1.Cells[6,0]:='開戶行';
stringgrid1.Cells[7,0]:='銀行帳號';
stringgrid1.Cells[8,0]:='信譽';
stringgrid1.Cells[9,0]:='等級';
stringgrid1.Cells[0,i]:=ADOQuery1.Fieldbyname('客戶ID').AsString;
stringgrid1.Cells[1,i]:=ADOQuery1.Fieldbyname('公司名稱').AsString;
stringgrid1.Cells[2,i]:=ADOQuery1.Fieldbyname('聯系人名字').AsString;
stringgrid1.Cells[3,i]:=ADOQuery1.Fieldbyname('地址').AsString;
stringgrid1.Cells[4,i]:=ADOQuery1.Fieldbyname('電話號碼').AsString;
stringgrid1.Cells[5,i]:=ADOQuery1.Fieldbyname('傳真號碼').AsString;
stringgrid1.Cells[6,i]:=ADOQuery1.Fieldbyname('開戶行').AsString;
stringgrid1.Cells[7,i]:=ADOQuery1.Fieldbyname('銀行賬號').AsString;
stringgrid1.Cells[8,i]:=ADOQuery1.Fieldbyname('客戶信譽統計').AsString;
stringgrid1.Cells[9,i]:=ADOQuery1.Fieldbyname('客戶等級管理').AsString;
i:=i+1;
// recordnum:=recordnum+1;
ADOQuery1.Next;
end;
if edit1.Text='' then
showmessage('你輸入的信息為空');
end;
procedure TFormsupply.Button3Click(Sender: TObject);
var
i,j:integer;
begin
if edit3.Text<>'' then
begin
ADOQuery1.Close;
ADOQuery1.SQL.Clear;
ADOQuery1.SQL.Add('select * from 供應商 where 聯系人 like ''%'+edit3.Text+'%''');
ADOQuery1.Open;
for i:=1 to 100 do
for j:=0 to 100 do
stringgrid1.Cells[i,j]:='';
i:=1;
// recordnum:=0;
while not ADOQuery1.Eof do
begin
//設置列寬
stringgrid1.ColWidths[0]:=32;
stringgrid1.ColWidths[2]:=128;
stringgrid1.ColWidths[4]:=128;
stringgrid1.ColWidths[7]:=128;
stringgrid1.ColWidths[9]:=128;
//----顯示查詢-------////
stringgrid1.Cells[0,0]:='供應商編號';
stringgrid1.Cells[1,0]:='供應商名稱';
stringgrid1.Cells[2,0]:='聯系人';
stringgrid1.Cells[3,0]:='地址';
stringgrid1.Cells[4,0]:='電話';
stringgrid1.Cells[5,0]:='傳真';
stringgrid1.Cells[6,0]:='開戶行';
stringgrid1.Cells[7,0]:='銀行帳號';
stringgrid1.Cells[8,0]:='信譽';
stringgrid1.Cells[9,0]:='等級';
stringgrid1.Cells[0,i]:=ADOQuery1.Fieldbyname('客戶ID').AsString;
stringgrid1.Cells[1,i]:=ADOQuery1.Fieldbyname('公司名稱').AsString;
stringgrid1.Cells[2,i]:=ADOQuery1.Fieldbyname('聯系人名字').AsString;
stringgrid1.Cells[3,i]:=ADOQuery1.Fieldbyname('地址').AsString;
stringgrid1.Cells[4,i]:=ADOQuery1.Fieldbyname('電話號碼').AsString;
stringgrid1.Cells[5,i]:=ADOQuery1.Fieldbyname('傳真號碼').AsString;
stringgrid1.Cells[6,i]:=ADOQuery1.Fieldbyname('開戶行').AsString;
stringgrid1.Cells[7,i]:=ADOQuery1.Fieldbyname('銀行賬號').AsString;
stringgrid1.Cells[8,i]:=ADOQuery1.Fieldbyname('客戶信譽統計').AsString;
stringgrid1.Cells[9,i]:=ADOQuery1.Fieldbyname('客戶等級管理').AsString;
i:=i+1;
// recordnum:=recordnum+1;
ADOQuery1.Next;
end;
end;
if edit3.Text='' then
begin
showmessage('你輸入的信息為空');
end;
end;
procedure TFormsupply.Button2Click(Sender: TObject);
var
i,j:integer;
begin
if edit2.Text<>'' then
begin
ADOQuery1.Close;
ADOQuery1.SQL.Clear;
ADOQuery1.SQL.Add('select * from 供應商 where 地址 like ''%'+edit2.Text+'%''');
ADOQuery1.Open;
for i:=1 to 100 do
for j:=0 to 100 do
stringgrid1.Cells[i,j]:='';
i:=1;
// recordnum:=0;
while not ADOQuery1.Eof do
begin
//設置列寬
stringgrid1.ColWidths[0]:=32;
stringgrid1.ColWidths[2]:=128;
stringgrid1.ColWidths[4]:=128;
stringgrid1.ColWidths[7]:=128;
stringgrid1.ColWidths[9]:=128;
//----顯示查詢-------////
stringgrid1.Cells[0,0]:='供應商編號';
stringgrid1.Cells[1,0]:='供應商名稱';
stringgrid1.Cells[2,0]:='聯系人';
stringgrid1.Cells[3,0]:='地址';
stringgrid1.Cells[4,0]:='電話';
stringgrid1.Cells[5,0]:='傳真';
stringgrid1.Cells[6,0]:='開戶行';
stringgrid1.Cells[7,0]:='銀行帳號';
stringgrid1.Cells[8,0]:='信譽';
stringgrid1.Cells[9,0]:='等級';
stringgrid1.Cells[0,i]:=ADOQuery1.Fieldbyname('客戶ID').AsString;
stringgrid1.Cells[1,i]:=ADOQuery1.Fieldbyname('公司名稱').AsString;
stringgrid1.Cells[2,i]:=ADOQuery1.Fieldbyname('聯系人名字').AsString;
stringgrid1.Cells[3,i]:=ADOQuery1.Fieldbyname('地址').AsString;
stringgrid1.Cells[4,i]:=ADOQuery1.Fieldbyname('電話號碼').AsString;
stringgrid1.Cells[5,i]:=ADOQuery1.Fieldbyname('傳真號碼').AsString;
stringgrid1.Cells[6,i]:=ADOQuery1.Fieldbyname('開戶行').AsString;
stringgrid1.Cells[7,i]:=ADOQuery1.Fieldbyname('銀行賬號').AsString;
stringgrid1.Cells[8,i]:=ADOQuery1.Fieldbyname('客戶信譽統計').AsString;
stringgrid1.Cells[9,i]:=ADOQuery1.Fieldbyname('客戶等級管理').AsString;
i:=i+1;
// recordnum:=recordnum+1;
ADOQuery1.Next;
end;
end;
if edit2.Text='' then
begin
showmessage('你輸入的信息為空');
end;
end;
end.
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -