Скачиваний:
10
Добавлен:
17.06.2023
Размер:
1.58 Mб
Скачать

f:=main.ADOQuery2.FieldByName('flag').AsBoolean; s:=main.ADOQuery2.FieldByName('id').AsInteger;

if f then begin ex:=false;

showmessage('Отказано в доступе!'); main.Close;

end else begin

main.ADOQuery2.Active:=false;

main.ADOQuery2.SQL.Clear; main.ADOQuery2.SQL.Add('update f_flag set flag=true where id='+inttostr(s));

main.ADOQuery2.ExecSQL; end; }

end.

unit Unit2; interface uses

Windows, Messages, SysUtils, Variants, Classes, Graphics,

Controls, Forms,

Dialogs, DB, ADODB, Grids, DBGrids, Unit8, StdCtrls, Buttons; type

TfmPrepodavateli = class(TForm)

DBGrid1: TDBGrid;

ADODataSet1: TADODataSet;

DataSource1: TDataSource;

ADOQuery1: TADOQuery;

ComboBox1: TComboBox;

Label1: TLabel;

Button4: TButton;

ComboBox2: TComboBox;

Button5: TButton;

Edit1: TEdit;

Label2: TLabel;

Button6: TButton;

ADOQuery2: TADOQuery;

BitBtn1: TBitBtn;

BitBtn2: TBitBtn;

BitBtn3: TBitBtn;

procedure Button5Click(Sender: TObject); procedure Button4Click(Sender: TObject); procedure FormShow(Sender: TObject);

procedure Button6Click(Sender: TObject);

procedure ComboBox1KeyPress(Sender: TObject; var Key: Char);

procedure ComboBox2KeyPress(Sender: TObject; var Key: Char);

procedure BitBtn1Click(Sender: TObject); procedure BitBtn2Click(Sender: TObject); procedure BitBtn3Click(Sender: TObject); private

{Private declarations } public

{Public declarations } end;

var

fmPrepodavateli: TfmPrepodavateli;

implementation

uses Unit15, Unit17, Unit4, Unit9, Unit24; {$R *.dfm}

procedure TfmPrepodavateli.Button5Click(Sender: TObject); begin

If ComboBox2.Text='ФИО' then begin ADODataSet1.Active:=false;

ADODataSet1.CommandText:='select P_Tab_N, P_FIO, C_Kategoria from Prepodavateli, Categoria where P_Kategoria=C_N order by P_FIO';

ADODataSet1.Active:=true; end

else begin

ADODataSet1.Active:=false;

ADODataSet1.CommandText:='select P_Tab_N, P_FIO,

C_Kategoria from Prepodavateli, Categoria where P_Kategoria=C_N order by P_Tab_N';

ADODataSet1.Active:=true; end

end;

procedure TfmPrepodavateli.Button4Click(Sender: TObject); var s,n:string;

begin

if ComboBox1.Text='ФИО' then begin

s:=Edit1.Text;

n:=inttostr(length(s));

ADODataSet1.Active:=false;

ADODataSet1.CommandText:='select P_Tab_N, P_FIO,

C_Kategoria from Prepodavateli, Categoria where P_Kategoria=C_N and left(P_FIO,'+n+')='''+s+'''';

ADODataSet1.Active:=true; end ;

if ComboBox1.Text='ТабНомер' then begin

s:=Edit1.Text;

n:=inttostr(length(s));

ADODataSet1.Active:=false;

ADODataSet1.CommandText:='select P_Tab_N, P_FIO,

C_Kategoria from Prepodavateli, Categoria where P_Kategoria=C_N and left(P_Tab_N,'+n+')='''+s+'''';

ADODataSet1.Active:=true;

end;

if ComboBox1.Text='Должность' then begin

s:=Edit1.Text;

n:=inttostr(length(s));

ADODataSet1.Active:=false;

ADODataSet1.CommandText:='select P_Tab_N, P_FIO,

C_Kategoria from Prepodavateli, Categoria where P_Kategoria=C_N and left(C_Kategoria,'+n+')='''+s+'''';

ADODataSet1.Active:=true;

end;

end;

procedure TfmPrepodavateli.FormShow(Sender: TObject); begin

ADODataSet1.Active:=false; AdODataSet1.CommandText:='select P_Tab_N, P_FIO, C_Kategoria from Prepodavateli, Categoria'

+' where P_Kategoria=C_N'; ADODataSet1.Active:=true;

end;

procedure TfmPrepodavateli.Button6Click(Sender: TObject); begin

Close;

end;

procedure TfmPrepodavateli.ComboBox1KeyPress(Sender: TObject;

var Key: Char); begin

case key of '0'..'9' :key:=#0; end;

end;

procedure TfmPrepodavateli.ComboBox2KeyPress(Sender: TObject;

var Key: Char); begin

case key of '0'..'9':key:=#0; end;

end;

procedure TfmPrepodavateli.BitBtn1Click(Sender: TObject); begin

fmPrepDob.ShowModal;

end;

procedure TfmPrepodavateli.BitBtn2Click(Sender: TObject); begin

fmPrepRed.ShowModal;

end;

procedure TfmPrepodavateli.BitBtn3Click(Sender: TObject); var a:string;

begin fmUdPrep.ShowModal; end;

end.

unit Unit3; interface uses

Windows, Messages, SysUtils, Variants, Classes, Graphics,

Controls, Forms,

Dialogs, DB, ADODB, StdCtrls, Grids, DBGrids, Unit8, Buttons; type

TfmGruppi = class(TForm)

DBGrid2: TDBGrid;

Edit2: TEdit;

Edit3: TEdit;

ADODataSet2: TADODataSet;

DataSource2: TDataSource;

ADOQuery1: TADOQuery;

Label1: TLabel;

Label2: TLabel;

Edit1: TEdit;

Button2: TButton;

Label3: TLabel;

ComboBox1: TComboBox;

Label4: TLabel;

Button3: TButton;

Button5: TButton;

Label5: TLabel;

Label6: TLabel;

Edit4: TEdit;

Edit5: TEdit;

BitBtn1: TBitBtn;

BitBtn3: TBitBtn;

Button1: TButton;

procedure Button2Click(Sender: TObject); procedure Button3Click(Sender: TObject); procedure FormShow(Sender: TObject); procedure Button5Click(Sender: TObject);

procedure Edit3KeyPress(Sender: TObject; var Key: Char); procedure Edit5KeyPress(Sender: TObject; var Key: Char); procedure BitBtn1Click(Sender: TObject);

procedure BitBtn3Click(Sender: TObject); procedure Button1Click(Sender: TObject); private

{Private declarations } public

{Public declarations } end;

var

fmGruppi: TfmGruppi;

implementation uses Unit9, Unit25; {$R *.dfm}

procedure TfmGruppi.Button2Click(Sender: TObject); var s,n:string;

begin s:=Edit1.Text;

n:=inttostr(length(s));

ADODataSet2.Active:=false; ADODataSet2.CommandText:='select G_Gruppa,G_Kolvo from

Gruppi where left(G_Gruppa,'+n+')='''+s+'''';

ADODataSet2.Active:=true;

end;

procedure TfmGruppi.Button3Click(Sender: TObject); begin

If ComboBox1.Text='Группа' then

begin ADODataSet2.Active:=false;

ADODataSet2.CommandText:='select G_Gruppa,G_Kolvo from Gruppi order by G_Gruppa';

ADODataSet2.Active:=true; end

else begin

ADODataSet2.Active:=false; ADODataSet2.CommandText:='select G_Gruppa,G_Kolvo from

Gruppi order by G_kolvo'; ADODataSet2.Active:=true; end

end;

procedure TfmGruppi.FormShow(Sender: TObject); begin

ADODataSet2.Active:=true;

end;

procedure TfmGruppi.Button5Click(Sender: TObject); begin

Close;

end;

procedure TfmGruppi.Edit3KeyPress(Sender: TObject; var Key: Char);

begin

if not (key in ['0'..'9',#8]) then key:=#0; end;

procedure TfmGruppi.Edit5KeyPress(Sender: TObject; var Key: Char);

begin

if not (key in ['0'..'9',#8]) then key:=#0; end;

procedure TfmGruppi.BitBtn1Click(Sender: TObject); var

i:integer; begin

ADOQuery1.SQL.Clear;

if (Edit2.Text<>'') and (Edit3.Text<>'') then begin

ADOQuery1.SQL.Add('insert into gruppi ( G_Gruppa, G_kolvo) values ('''+Edit2.Text+''','''+Edit3.Text+''')'); ADOQuery1.ExecSQL;

fmGruppi.ADODataSet2.Active:=false;

fmGruppi.ADODataSet2.Active:=true;

Edit2.Text:='';

Edit3.Text:='';

end

else

ShowMessage('Заполнены не все поля!') end;

procedure TfmGruppi.BitBtn3Click(Sender: TObject); begin

fmUdGR.ShowModal;

end;

procedure TfmGruppi.Button1Click(Sender: TObject); var a:string;

begin a:=fmGruppi.ADODataSet2.FieldValues['G_N']; fmGruppi.ADOQuery1.SQL.Clear;

if (Edit4.Text<>'') and (Edit5.Text<>'') then begin

fmGruppi.ADOQuery1.SQL.Add('update Gruppi set G_Gruppa='''+Edit4.Text+''', G_Kolvo='''+Edit5.Text+''' where G_N='+a+'');

fmGruppi.ADOQuery1.ExecSQL;

fmGruppi.ADODataSet2.Active:=false;

fmGruppi.ADODataSet2.Active:=True;

Edit4.Text:='';

Edit5.Text:='';

end

else

ShowMessage('Заполнены не все поля!') end

end.

unit Unit4; interface uses

Windows, Messages, SysUtils, Variants, Classes, Graphics,

Controls, Forms,

Dialogs, DB, Grids, DBGrids, ADODB, StdCtrls, Unit8, Buttons,

Unit9;

type

TfmDisciplini = class(TForm)

ADODataSet1: TADODataSet;

DBGrid1: TDBGrid;

DataSource1: TDataSource;

ADOQuery1: TADOQuery;

ComboBox1: TComboBox;

Edit1: TEdit;

Button4: TButton;

Label1: TLabel;

ComboBox2: TComboBox;

Button5: TButton;

Label2: TLabel;

Button6: TButton;

Button7: TButton;

BitBtn1: TBitBtn;

BitBtn2: TBitBtn;

BitBtn3: TBitBtn;

procedure FormShow(Sender: TObject); procedure Button4Click(Sender: TObject); procedure Button5Click(Sender: TObject); procedure Button6Click(Sender: TObject); procedure Button7Click(Sender: TObject);

procedure ComboBox2KeyPress(Sender: TObject; var Key: Char);

procedure ComboBox1KeyPress(Sender: TObject; var Key: Char);

procedure BitBtn1Click(Sender: TObject); procedure BitBtn2Click(Sender: TObject); procedure BitBtn3Click(Sender: TObject); private

{Private declarations } public

{Public declarations } end;

var

fmDisciplini: TfmDisciplini;

implementation

uses Unit5, Unit13, Unit23; {$R *.dfm}

procedure TfmDisciplini.FormShow(Sender: TObject); begin

ADODataSet1.Active:=true;

end;

procedure TfmDisciplini.Button4Click(Sender: TObject); var s,n:string;

begin

if ComboBox1.Text='Дисциплина' Then begin

s:=Edit1.Text;

n:=inttostr(length(s));

ADODataSet1.Active:=false;

ADODataSet1.Active:=false;

ADODataSet1.CommandText:='select *, IIf(D_RZ,''Да'',''Нет'')

ADODataSet1.CommandText:='select *,

as RZ, IIf(D_Ikzamen,''Да'',''Нет'') as EKZ from Disciplini';

IIf(D_RZ,''Да'',''Нет'') as RZ, IIf(D_Ikzamen,''Да'',''Нет'') as EKZ

ADODataSet1.Active:=true

from Disciplini where left(D_Disciplina,'+n+')='''+s+'''';

end;

ADODataSet1.Active:=true

procedure TfmDisciplini.ComboBox2KeyPress(Sender: TObject;

end

var Key: Char);

else

begin

begin

case key of

s:=Edit1.Text;

'0'..'9' :key:=#0;

n:=inttostr(length(s));

end;

ADODataSet1.Active:=false;

end;

ADODataSet1.CommandText:='select *,

 

IIf(D_RZ,''Да'',''Нет'') as RZ, IIf(D_Ikzamen,''Да'',''Нет'') as EKZ

procedure TfmDisciplini.ComboBox1KeyPress(Sender: TObject;

from Disciplini where left(D_N_semestra,'+n+')='''+s+'''';

var Key: Char);

ADODataSet1.Active:=true

begin

end;

case key of

end;

'0'..'9' :key:=#0;

procedure TfmDisciplini.Button5Click(Sender: TObject);

end;

begin

end;

if ComboBox2.Text='Дисциплина' Then

procedure TfmDisciplini.BitBtn1Click(Sender: TObject);

begin

begin

ADODataSet1.Active:=false;

fmDisDob.ShowModal;

ADODataSet1.CommandText:='select *,

end;

IIf(D_RZ,''Да'',''Нет'') as RZ, IIf(D_Ikzamen,''Да'',''Нет'') as EKZ

procedure TfmDisciplini.BitBtn2Click(Sender: TObject);

from Disciplini order by D_Disciplina';

begin

ADODataSet1.Active:=true

fmDisRed.ShowModal;

end

end;

else

procedure TfmDisciplini.BitBtn3Click(Sender: TObject);

begin

begin

ADODataSet1.Active:=false;

fmUdDis.ShowModal;

ADODataSet1.CommandText:='select *,

end;

IIf(D_RZ,''Да'',''Нет'') as RZ, IIf(D_Ikzamen,''Да'',''Нет'') as EKZ

end.

from Disciplini order by D_N_semestra';

unit Unit5;

ADODataSet1.Active:=true;

 

end;

interface

end;

uses

procedure TfmDisciplini.Button6Click(Sender: TObject);

Windows, Messages, SysUtils, Variants, Classes, Graphics,

begin

Controls, Forms,

Edit1.Clear;

Dialogs, StdCtrls, Unit4, DB, ADODB;

Close;

type

end;

TfmDisDob = class(TForm)

procedure TfmDisciplini.Button7Click(Sender: TObject);

Edit1: TEdit;

begin

Edit3: TEdit;

Edit4: TEdit;

Edit5: TEdit;

ComboBox1: TComboBox;

ComboBox2: TComboBox;

Label1: TLabel;

Label2: TLabel;

Label3: TLabel;

Label4: TLabel;

Label5: TLabel;

Label6: TLabel;

Label7: TLabel;

Edit2: TEdit;

Button2: TButton;

Button1: TButton;

procedure Button2Click(Sender: TObject); procedure Button1Click(Sender: TObject);

procedure Edit2KeyPress(Sender: TObject; var Key: Char); procedure Edit3KeyPress(Sender: TObject; var Key: Char); procedure FormCreate(Sender: TObject);

procedure FormShow(Sender: TObject);

procedure Edit4KeyPress(Sender: TObject; var Key: Char); procedure Edit5KeyPress(Sender: TObject; var Key: Char); procedure ComboBox1KeyPress(Sender: TObject; var Key:

Char);

procedure ComboBox2KeyPress(Sender: TObject; var Key: Char);

private

{Private declarations } public

{Public declarations } end;

var

fmDisDob: TfmDisDob;

implementation {$R *.dfm}

procedure TfmDisDob.Button2Click(Sender: TObject); begin

Close;

end;

procedure TfmDisDob.Button1Click(Sender: TObject); var

r,ek:string; begin

If ComboBox2.ItemIndex=0 then ek:='true' else ek:='false'; If ComboBox1.ItemIndex=0 then r:='true' else r:='false';

if ((Edit1.Text='') or (Edit2.Text='')or (Edit3.Text='') or (Edit4.Text='') or (Edit5.Text=''))then

ShowMessage('Введены не все необходимые данные') else

if Edit2.Text='0' then ShowMessage('Номер семестра не может быть нулевым')

else begin

fmDisciplini.ADOQuery1.SQL.Clear; fmDisciplini.ADOQuery1.SQL.Add('insert into disciplini (D_Disciplina, D_N_semestra, D_Lekcii, D_Laboratornii,D_Practica, D_RZ,D_Ikzamen) values ('''+Edit1.Text+'_'+Edit2.Text+''','''+Edit2.Text+''','''+Edit3.Text+''',

'''+Edit4.Text+''','''+Edit5.Text+''','+r+','+ek+')');

fmDisciplini.ADOQuery1.ExecSQL;

fmDisciplini.ADODataSet1.Active:=false;

fmDisciplini.ADODataSet1.Active:=true;

close;

end;

end;

procedure TfmDisDob.Edit2KeyPress(Sender: TObject; var Key: Char);

begin

if not (key in ['0'..'9',#8]) then key:=#0; end;

procedure TfmDisDob.Edit3KeyPress(Sender: TObject; var Key: Char);

begin

if not (key in ['0'..'9',#8]) then key:=#0; end;

procedure TfmDisDob.FormCreate(Sender: TObject); begin

Edit1.Text:='';

Edit2.Text:='';

Edit3.Text:='';

Edit4.Text:='';

Edit5.Text:='';

end;

procedure TfmDisDob.FormShow(Sender: TObject); begin

Edit1.Text:='';

Edit2.Text:='0';

Edit3.Text:='0';

Edit4.Text:='0';

Edit5.Text:='0';

end;

procedure TfmDisDob.Edit4KeyPress(Sender: TObject; var Key: Char);

begin

if not (key in ['0'..'9',#8]) then key:=#0; end;

procedure TfmDisDob.Edit5KeyPress(Sender: TObject; var Key: Char);

begin

if not (key in ['0'..'9',#8]) then key:=#0; end;

procedure TfmDisDob.ComboBox1KeyPress(Sender: TObject; var Key: Char);

begin case key of

'0'..'9' :key:=#0; end;

end;

procedure TfmDisDob.ComboBox2KeyPress(Sender: TObject; var Key: Char);

begin case key of

'0'..'9' :key:=#0; end;

end;

end.

unit Unit6;

interface uses

Windows, Messages, SysUtils, Variants, Classes, Graphics,

Controls, Forms,

Dialogs, Grids, DBGrids, DB, ADODB, Unit8, StdCtrls, Buttons; type

TfmTarif = class(TForm)

DataSource1: TDataSource;

ADODataSet1: TADODataSet;

DBGrid1: TDBGrid;

Button1: TButton;

Edit1: TEdit;

Label2: TLabel;

Button2: TButton;

ADOQuery1: TADOQuery;

procedure Button2Click(Sender: TObject); procedure FormShow(Sender: TObject); procedure Button1Click(Sender: TObject);

procedure Edit1KeyPress(Sender: TObject; var Key: Char); private

{Private declarations } public

{Public declarations } end;

var

fmTarif: TfmTarif;

implementation {$R *.dfm}

procedure TfmTarif.Button2Click(Sender: TObject); begin

Close;

end;

procedure TfmTarif.FormShow(Sender: TObject); begin

AdoDataSet1.Active:=True;

end;

procedure TfmTarif.Button1Click(Sender: TObject); var

a:string; begin

a:=ADODataSet1.FieldValues['C_N']; ADOQuery1.SQL.Clear; ADOQuery1.SQL.Add('update Categoria set C_Tarif_v_chas='''+Edit1.Text+''' where C_N='+a+''); ADOQuery1.ExecSQL; ADODataSet1.Active:=false; ADODataSet1.Active:=True;

end;

procedure TfmTarif.Edit1KeyPress(Sender: TObject; var Key: Char);

begin

if not (key in ['0'..'9',#8]) then key:=#0; end;

end.

nit Unit7;

interface uses

Windows, Messages, SysUtils, Variants, Classes, Graphics,

Controls, Forms,

Dialogs, StdCtrls; type

TfmRezerv = class(TForm)

Edit1: TEdit;

Button1: TButton;

Button2: TButton;

Button3: TButton;

OpenDialog1: TOpenDialog;

procedure Button1Click(Sender: TObject); procedure Button2Click(Sender: TObject); procedure Button3Click(Sender: TObject);

procedure Edit1KeyPress(Sender: TObject; var Key: Char); private

{Private declarations } public

{Public declarations } end;

var

fmRezerv: TfmRezerv;

implementation {$R *.dfm}

procedure TfmRezerv.Button1Click(Sender: TObject); begin

OpenDialog1.InitialDir:= Edit1.Text;

if OpenDialog1.Execute then Edit1.Text:= ExtractFilePath(OpenDialog1.FileName); end;

procedure TfmRezerv.Button2Click(Sender: TObject); var i:integer;

d,t:string; begin i:=0;

d:=DateToStr(Date);

t:=TimeToStr(Time); for i:=1 to length(t) do

begin

if t[i]=':' then t[i]:='-'; end;

ForceDirectories(Edit1.text + 'Rezerv\'+d); // создание папки для резервной копии в папке с базой

CopyFile(pansiChar(Edit1.text+'\Oplata.mdb'),

pansiChar(Edit1.text+'Rezerv\'+d+'\OplataRezerv'+t+'.mdb'),Fals e); //Резервное копирование базы в папку DataBase/Резерв

Application.MessageBox('Резервное копирование выполнено!', '', mb_ok);

Close;

end;

procedure TfmRezerv.Button3Click(Sender: TObject); begin

Close;

end;

procedure TfmRezerv.Edit1KeyPress(Sender: TObject; var Key: Char);

begin case key of

'0'..'9':key:=#0; end;

end;

end.

unit Unit8; interface uses

Windows, Messages, SysUtils, Variants, Classes, Graphics,

Controls, Forms,

Dialogs, StdCtrls, Buttons,Unit1, DB, ADODB, iniFiles, XPMan; type

TfmID = class(TForm)

BitBtn1: TBitBtn;

BitBtn2: TBitBtn;

Button1: TButton;

Par: TEdit;

Label1: TLabel;

Label2: TLabel;

Polz: TComboBox;

ADOQuery1: TADOQuery;

ADOConnection1: TADOConnection;

ADOTable1: TADOTable;

ADOQuery2: TADOQuery;

XPManifest1: TXPManifest;

procedure BitBtn2Click(Sender: TObject); procedure BitBtn1Click(Sender: TObject); procedure Button1Click(Sender: TObject); procedure FormClose(Sender: TObject; var Action:

TCloseAction);

procedure FormCreate(Sender: TObject);

procedure PolzKeyPress(Sender: TObject; var Key: Char); private

{Private declarations } public

{Public declarations } end;

var

fmID: TfmID; ex:boolean;

implementation

uses Unit10, Unit4, Unit3, Unit2, Unit9; {$R *.dfm}

procedure TfmID.BitBtn2Click(Sender: TObject); begin

Close;

end;

function Enter:boolean; var f:boolean; s:integer;

begin ex:=true;

fmID.ADOQuery1.Sql.Clear;

fmID.ADOQuery1.Active:=false; fmID.ADOQuery1.SQL.Add('select * from f_flag'); fmID.ADOQuery1.Active:=true; fmID.ADOQuery1.First; f:=fmID.ADOQuery1.FieldByName('flag').AsBoolean; s:=fmID.ADOQuery1.FieldByName('id').AsInteger; if f then

begin ex:=false;

showmessage('Отказано в доступе!'); main.Close; FMID.Close;

end else begin

fmID.ADOQuery1.Active:=false;

fmID.ADOQuery1.SQL.Clear; fmID.ADOQuery1.SQL.Add('update f_flag set flag=true where id='+inttostr(s));

fmID.ADOQuery1.ExecSQL;

end;

end;

procedure TfmID.BitBtn1Click(Sender: TObject); var

IniFile : TIniFile;

Baseput : string;

begin ADOConnection1.Connected:=False; ADOTable1.Active:=true;

ADOTable1.Locate('P_Polzovatel',Polz.Text,[]);

AdoQuery2.SQL.Clear;

If (Polz.Text='Администратор') and (Par.Text=ADOTable1.FieldByName('P_Parol').AsString) then

begin

Main.Caption:=Main.Caption+' ---=== Режим для администратора===---';

Main.ShowModal;

end

else

If (Polz.Text='Методист') and (Par.Text=ADOTable1.FieldByName('P_Parol').AsString) then begin

Main.Caption:=Main.Caption+' ---=== Режим для методиста

===---'; fmDisciplini.BitBtn3.Visible:=false; fmPrepodavateli.BitBtn3.Visible:=false; fmGruppi.BitBtn3.Visible:=false; fmGrPrep.BitBtn2.Visible:=false; main.N15.Enabled:=false; ADOConnection1.Connected := True; Main.Showmodal;

end else begin

Application.MessageBox('Пароль введен неверно!', 'Внимание!', MB_OK);

Par.Text:='';

par.SetFocus;

end;

end;

procedure TfmID.Button1Click(Sender: TObject); begin

fmPut.ShowModal;

end;

procedure TfmID.FormClose(Sender: TObject; var Action: TCloseAction);

var f:boolean; s:integer; begin

if ex then begin

fmID.ADOQuery1.SQL.Clear;

fmID.ADOQuery1.Active:=false; fmID.ADOQuery1.SQL.Add('select * from f_flag'); fmID.ADOQuery1.Active:=true; fmID.ADOQuery1.First; f:=fmID.ADOQuery1.FieldByName('flag').AsBoolean; s:=fmID.ADOQuery1.FieldByName('id').AsInteger; fmID.ADOQuery1.Active:=false; fmID.ADOQuery1.SQL.Clear;

fmID.ADOQuery1.SQL.Add('update f_flag set flag=false where id='+inttostr(s));

fmID.ADOQuery1.ExecSQL;

end;

end;

procedure TfmID.FormCreate(Sender: TObject); begin

enter;

end;

procedure TfmID.PolzKeyPress(Sender: TObject; var Key: Char); begin

case key of '0'..'9' :key:=#0; end;

end;

end.

unit Unit9; interface uses

Windows, Messages, SysUtils, Variants, Classes, Graphics,

Controls, Forms,

Dialogs,Unit8, DB, ADODB, Grids, DBGrids, StdCtrls, Buttons;

type

TfmGrPrep = class(TForm)

Edit1: TEdit;

Button1: TButton;

Button2: TButton;

Label2: TLabel;

ComboBox1: TComboBox;

Label3: TLabel;

ComboBox2: TComboBox;

Button6: TButton;

ADODataSet1: TADODataSet;

ADOQuery1: TADOQuery;

DataSource1: TDataSource;

DBGrid1: TDBGrid;

BitBtn1: TBitBtn;

BitBtn2: TBitBtn;

procedure Button1Click(Sender: TObject); procedure FormShow(Sender: TObject); procedure Button6Click(Sender: TObject); procedure Button2Click(Sender: TObject);

procedure ComboBox2KeyPress(Sender: TObject; var Key: Char);

procedure ComboBox1KeyPress(Sender: TObject; var Key: Char);

procedure Edit1KeyPress(Sender: TObject; var Key: Char); procedure BitBtn1Click(Sender: TObject);

procedure BitBtn2Click(Sender: TObject); private

{Private declarations } public

{Public declarations } end;

var

fmGrPrep: TfmGrPrep;

implementation

uses Unit14, Unit16, Unit4, Unit26; {$R *.dfm}

procedure TfmGrPrep.Button1Click(Sender: TObject); var s,n:string;

begin

If ComboBox1.Text='ФИО' then begin

s:=Edit1.Text;

Соседние файлы в папке Курсовые работы