Добавил:
Вуз:
Предмет:
Файл:
База данных (лаба) / Более сложный варинат / Новый текстовый документ
.txt unit Unit2;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Data.DB, Data.Win.ADODB, Vcl.StdCtrls,
Vcl.Grids, Vcl.DBGrids, Vcl.ExtCtrls;
type
TForm2 = class(TForm)
Panel1: TPanel;
Panel2: TPanel;
MNameTo: TMemo;
DBGNameFrom: TDBGrid;
MNameFrom: TMemo;
DGNameTo: TDBGrid;
Button1: TButton;
Button2: TButton;
ADOQ: TADOQuery;
DataSource: TDataSource;
procedure Button2Click(Sender: TObject);
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form2: TForm2;
implementation
{$R *.dfm}
procedure TForm2.Button1Click(Sender: TObject);
var
i:integer;
begin
with ADOQ do
begin if active then close;
SQL.Clear;
SQL.Add('SELECT * FROM FIO'); open; for i := 0 to MNameFrom.Lines.Count-1 do
begin
insert; fieldbyname('fio').Value := MNameFrom.Lines[I];
end;
post;
end;
end;
procedure TForm2.Button2Click(Sender: TObject);
Var i: integer;
begin
MNameTo.Lines.Clear;
ADOQ.First;
for i := 0 to ADOQ.RecordCount-1 do
begin
MNameTo.LInes.Add(ADOQ.FieldByName('Kod').
AsString+' 'ADOQ.FieldByName('FIO').
AsString);
ADOQ.Next;
end;
end;
end.
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Data.DB, Data.Win.ADODB, Vcl.StdCtrls,
Vcl.Grids, Vcl.DBGrids, Vcl.ExtCtrls;
type
TForm2 = class(TForm)
Panel1: TPanel;
Panel2: TPanel;
MNameTo: TMemo;
DBGNameFrom: TDBGrid;
MNameFrom: TMemo;
DGNameTo: TDBGrid;
Button1: TButton;
Button2: TButton;
ADOQ: TADOQuery;
DataSource: TDataSource;
procedure Button2Click(Sender: TObject);
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form2: TForm2;
implementation
{$R *.dfm}
procedure TForm2.Button1Click(Sender: TObject);
var
i:integer;
begin
with ADOQ do
begin if active then close;
SQL.Clear;
SQL.Add('SELECT * FROM FIO'); open; for i := 0 to MNameFrom.Lines.Count-1 do
begin
insert; fieldbyname('fio').Value := MNameFrom.Lines[I];
end;
post;
end;
end;
procedure TForm2.Button2Click(Sender: TObject);
Var i: integer;
begin
MNameTo.Lines.Clear;
ADOQ.First;
for i := 0 to ADOQ.RecordCount-1 do
begin
MNameTo.LInes.Add(ADOQ.FieldByName('Kod').
AsString+' 'ADOQ.FieldByName('FIO').
AsString);
ADOQ.Next;
end;
end;
end.
Соседние файлы в папке Более сложный варинат