Пример базы данных на Delphi 2.0

  • Просмотров 2009
  • Скачиваний 466
  • Размер файла 57
    Кб

unit redakt; interface uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, ExtCtrls, DBCtrls, Grids, DBGrids, StdCtrls, Mask, Buttons, DBCGrids; type TForm2 = class(TForm) Panel1: TPanel; Button3: TButton; Button4: TButton; Button6: TButton; Button7: TButton; Button5: TButton; Button8: TButton; Button9: TButton; Button10: TButton; RadioGroup1: TRadioGroup; CheckBox1: TCheckBox; BitBtn1: TBitBtn; Edit1: TEdit; RadioGroup2: TRadioGroup; CheckBox3: TCheckBox; DBGrid1: TDBGrid; DBEdit1: TDBEdit; Label1: TLabel; CheckBox2: TCheckBox; Edit2: TEdit; BitBtn2: TBitBtn; Label2: TLabel; procedure ComboBox1Change(Sender: TObject); procedure Button3Click(Sender: TObject); procedure Button4Click(Sender: TObject); procedure Button6Click(Sender: TObject); procedure

Button5Click(Sender: TObject); procedure Button7Click(Sender: TObject); procedure Button8Click(Sender: TObject); procedure Button9Click(Sender: TObject); procedure Button10Click(Sender: TObject); procedure RadioGroup1Click(Sender: TObject); procedure CheckBox1Click(Sender: TObject); procedure DBEdit1Change(Sender: TObject); procedure BitBtn1Click(Sender: TObject); procedure Edit1Change(Sender: TObject); procedure CheckBox3Click(Sender: TObject); procedure RadioGroup2Click(Sender: TObject); procedure DBEdit1Click(Sender: TObject); procedure CheckBox2Click(Sender: TObject); procedure SpeedButton1Click(Sender: TObject); procedure SpeedButton3Click(Sender: TObject); procedure SpeedButton4Click(Sender: TObject); procedure Edit2Change(Sender: TObject); procedure BitBtn2Click(Sender:

TObject); { procedure FormCreate(Sender: TObject);} private { Private declarations } public { Public declarations } end; var Form2: TForm2; implementation uses data, Enter, categor, Vopros2; {$R *.DFM} procedure TForm2.ComboBox1Change(Sender: TObject); begin {Form2.ComboBox1:=} end; procedure TForm2.Button3Click(Sender: TObject); begin DM.Table4.First; Form2.DBGrid1.SetFocus; end; procedure TForm2.Button4Click(Sender: TObject); begin DM.Table4.Next; Form2.DBGrid1.SetFocus; end; procedure TForm2.Button6Click(Sender: TObject); begin DM.Table4.Prior; Form2.DBGrid1.SetFocus; end; procedure TForm2.Button5Click(Sender: TObject); begin DM.Table4.Last; Form2.DBGrid1.SetFocus; end; procedure TForm2.Button7Click(Sender: TObject); begin DM.Table4.Edit; Form2.DBGrid1.SetFocus; end; procedure

TForm2.Button8Click(Sender: TObject); begin DM.Table4.Insert; Form2.DBGrid1.SetFocus; end; procedure TForm2.Button9Click(Sender: TObject); begin DM.Table4.Edit ; DM.Table4.Post; DM.Table1.Refresh; DM.Table2.Refresh; DM.Table3.Refresh; DM.Table4.Refresh; Form2.DBGrid1.Setfocus; end; procedure TForm2.Button10Click(Sender: TObject); begin if not DM.Table4.EOF then begin with DM.Table4 do begin DisableControls; Delete; { MessageDlg('╙фрышЄ№ ърЄхуюЁш■ ?',mtCustom,(mbYes),(mbNo));} EnableControls; Form2.DbGrid1.SetFocus; end; end; end; procedure TForm2.RadioGroup1Click(Sender: TObject); var Pole:shortstring; begin Case Form2.RadioGroup1.ItemIndex of 0: Pole:='ърЄхуюЁшш'; 1:Pole:='ЇшЁьх-шчуюЄютшЄхых'; 2:Pole:='ьюфхыш';

3:Pole:='Ўхэх'; 4:Pole:='╩юышўхёЄтє эр ёъырфх'; end; if Form2.RadioGroup1.ItemIndex=0 then DM.Table4.IndexFieldNames:='Categorija'; if Form2.RadioGroup1.ItemIndex=1 then DM.Table4.IndexFieldNames:='Firma'; if Form2.RadioGroup1.ItemIndex=2 then DM.Table4.IndexFieldNames:='Model'; if Form2.RadioGroup1.ItemIndex=3 then DM.Table4.IndexFieldNames:='CENAD'; if Form2.RadioGroup1.ItemIndex=4 then DM.Table4.IndexFieldNames:='SKLAD'; DM.Table4.Refresh; DM.Table4.Close; DM.Table4.Open; Form2.DbGrid1.SetFocus; end; procedure TForm2.CheckBox1Click(Sender: TObject); begin if Form2.CheckBox1.Checked then begin Form2.RadioGroup1.Visible:=True; Form2.RadioGroup1.ItemIndex:=0; end else begin DM.Table4.IndexFieldNames:=''; Form2.RadioGroup1.Visible:=False; end; end;