Приложение. Листинг и формы программы
Листинг файла unit1
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ComCtrls, jpeg, ExtCtrls, DB, ADODB, Grids, DBGrids, Menus,
StdCtrls, xpman, Buttons;
type
TForm1 = class(TForm)
Image1: TImage;
PageControl1: TPageControl;
TabSheet1: TTabSheet;
TabSheet2: TTabSheet;
TabSheet3: TTabSheet;
TabSheet4: TTabSheet;
TabSheet5: TTabSheet;
MainMenu1: TMainMenu;
N1: TMenuItem;
N2: TMenuItem;
N3: TMenuItem;
N4: TMenuItem;
N5: TMenuItem;
N6: TMenuItem;
N7: TMenuItem;
N8: TMenuItem;
DataSource1: TDataSource;
ADOConnection1: TADOConnection;
ADOTable1: TADOTable;
ADOConnection3: TADOConnection;
ADOTable3: TADOTable;
DataSource3: TDataSource;
ADOConnection4: TADOConnection;
ADOTable4: TADOTable;
DataSource4: TDataSource;
DataSource5: TDataSource;
ADOConnection5: TADOConnection;
ADOTable5: TADOTable;
BitBtn1: TBitBtn;
BitBtn2: TBitBtn;
BitBtn3: TBitBtn;
BitBtn4: TBitBtn;
Edit1: TEdit;
BitBtn5: TBitBtn;
Label1: TLabel;
Label2: TLabel;
ADOQuery1: TADOQuery;
DataSource6: TDataSource;
Label3: TLabel;
Label4: TLabel;
Image2: TImage;
ADOConnection2: TADOConnection;
ADOTable2: TADOTable;
DataSource2: TDataSource;
DBGrid1: TDBGrid;
DBGrid2: TDBGrid;
DBGrid3: TDBGrid;
DBGrid4: TDBGrid;
DBGrid5: TDBGrid;
procedure Edit1Change(Sender: TObject);
procedure BitBtn5Click(Sender: TObject);
procedure BitBtn1Click(Sender: TObject);
procedure BitBtn4Click(Sender: TObject);
procedure BitBtn3Click(Sender: TObject);
procedure BitBtn2Click(Sender: TObject);
procedure N3Click(Sender: TObject);
procedure N5Click(Sender: TObject);
procedure N6Click(Sender: TObject);
procedure N7Click(Sender: TObject);
procedure N8Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
uses Unit2, Unit3;
{$R *.dfm}
procedure TForm1.Edit1Change(Sender: TObject);
var table:string[15];
begin
table:='ôàìèëèÿ';
if Edit1.Text = '' then
DataSource1.DataSet:=ADOTable1;
if Edit1.Text <> ''
then
begin
with ADOQuery1 do
begin
Close;
ADOQuery1.SQL.Clear;
ADOQuery1.SQL.Add('SELECT *');
ADOQuery1.SQL.Add('from òàáëèöû ');
ADOQuery1.sql.Add('where '+table+' like "'+Edit1.Text+'%"') ;
ADOQuery1.Open;
if ADOQuery1.RecordCount <> 0 then
begin
DataSource1.DataSet:=ADOQuery1;
end
else begin
DataSource1.DataSet:=ADOTable1;
end;
end;
end;
end;
procedure TForm1.BitBtn5Click(Sender: TObject);
begin
ADOQuery1.Edit;
Label2.Caption:=ADOQuery1.FieldByName('ôàìèëèÿ').AsString;
Label3.Caption:=ADOQuery1.FieldByName('èìÿ').AsString;
Label4.Caption:=ADOQuery1.FieldByName('îò÷åñòâî').AsString;
Image2.Picture.LoadFromFile(ADOQuery1.FieldByName('ôîòî').AsString);
ADOQuery1.Post;
end;
procedure TForm1.BitBtn1Click(Sender: TObject);
begin
Form2.show;
Adotable1.Insert;
Adotable2.Insert;
end;
procedure TForm1.BitBtn4Click(Sender: TObject);
begin
close;
end;
procedure TForm1.BitBtn3Click(Sender: TObject);
begin
form1.Adotable1.Delete;
form1.Adotable2.Delete;
end;
procedure TForm1.BitBtn2Click(Sender: TObject);
begin
form2.Show;
end;
procedure TForm1.N3Click(Sender: TObject);
begin
form3.show;
end;
procedure TForm1.N5Click(Sender: TObject);
begin
form1.bitbtn1.click;
end;
procedure TForm1.N6Click(Sender: TObject);
begin
form1.BitBtn2.click;
end;
procedure TForm1.N7Click(Sender: TObject);
begin
form1.BitBtn3.click;
end;
procedure TForm1.N8Click(Sender: TObject);
begin
form1.BitBtn4.click;
end;
end.
Достарыңызбен бөлісу: |