Query ve Table Araçları Kullanımı

VERİ TABANI
QUERY




var

Form2: TForm2;

yol:string; //FOTO İÇİN YOL TANIMLAMA

implementation

{$R *.dfm}

procedure temizle();//TEMİZLE PROCEDURE

begin

form2.Edit1.Text:='';

form2.Edit2.Text:='';

form2.Edit3.Text:='';

form2.Edit4.Text:='';

form2.Edit5.Text:='';

form2.ComboBox1.Text:='Bölüm Seçiniz';

form2.RadioButton1.Checked:=true;

form2.Image1.Picture.Assign(nil);

form2.Edit1.SetFocus;

end;

procedure TForm2.Button1Click(Sender: TObject); //FOTO AÇMA

begin

opendialog1.Execute();

yol:=opendialog1.FileName;

image1.Picture.LoadFromFile(yol);

end;

procedure TForm2.Button2Click(Sender: TObject); // KAYIT

var

num,adsoy,cins,bol,ders,vize,fin:string;

begin

num:=edit1.Text;

adsoy:=edit2.Text;

if radiobutton1.Checked=true then

cins:='Kız'

else cins:='Erkek';

bol:=combobox1.Text;

ders:=edit3.Text;

vize:=edit4.Text;

fin:=edit5.Text;

query1.SQL.Clear;

query1.SQL.Add('insert into deneme');

query1.SQL.Add('(num,adsoy,cins,bol,ders,vize,fin,yol)');

query1.SQL.Add('values("'+num+'","'+adsoy+'","'+cins+'","'+bol+'","'+ders+'","'+vize+'","'+fin+'","'+yol+'")');

query1.ExecSQL;

temizle();

end;

procedure TForm2.Button3Click(Sender: TObject); //ARAMA

begin

query1.SQL.Clear;

query1.SQL.Add('select * from deneme where num like '+ quotedstr(edit1.Text));

query1.ExecSQL;

query1.Open;

edit1.Text:=query1.FieldByName('num').AsString;

edit2.Text:=query1.FieldByName('adsoy').AsString;

if 'Kız'=query1.FieldByName('cins').AsString then

radiobutton1.Checked:=true

else radiobutton2.Checked:=true;

combobox1.Text:=query1.FieldByName('bol').AsString;

edit3.Text:=query1.FieldByName('ders').AsString;

edit4.Text:=query1.FieldByName('vize').AsString;

edit5.Text:=query1.FieldByName('fin').AsString;

if query1.FieldByName('yol').AsString<>'' then

image1.Picture.LoadFromFile(query1.FieldByName('yol').AsString);

yol:=query1.FieldByName('yol').AsString;

end;

procedure TForm2.Button4Click(Sender: TObject);//SİLME

begin

query1.SQL.Clear;

query1.SQL.Add('delete from deneme where num like'+ quotedstr(edit1.Text));

query1.ExecSQL;

temizle();

end;

procedure TForm2.Button5Click(Sender: TObject);//DÜZELTME

var

cins:string;

begin

if radiobutton1.Checked=true then

cins:='Kız'

else cins:='Erkek';

query1.SQL.Clear;

query1.SQL.Add('update deneme set num="'+edit1.Text+'",adsoy="'+edit2.Text+'",cins="'+cins+'",bol="'+combobox1.Text+'", ders="'+edit3.Text+'",vize="'+edit4.Text+'",fin="'+edit5.Text+'",yol="'+yol+'" where num like'+quotedstr(edit1.Text));

query1.ExecSQL;

temizle();

end;

procedure TForm2.Button6Click(Sender: TObject);//TEMİZLE BUTONU

begin

temizle();

end;

procedure TForm2.Button7Click(Sender: TObject);//ÇIKIŞ

begin

self.Close;

end;

procedure TForm4.Button1Click(Sender: TObject); //LİSTELEME

begin

query1.SQL.Clear;

query1.SQL.Add('select * from deneme');

query1.ExecSQL;

query1.Open;

end;

procedure TForm4.Button2Click(Sender: TObject); //KLİSTELEME

begin

query1.SQL.Clear;

query1.SQL.Add('select * from deneme where bol like'+ quotedstr(combobox1.text));

query1.ExecSQL;

query1.Open;

end;

end.

TABLE

var

Form3: TForm3;

yol:string; //FOTO İÇİN YOL TANIMLAMA

implementation

{$R *.dfm}

procedure temizle(); //TEMİZLE PROCEDURE

begin

form3.Edit1.Text:='';

form3.Edit2.Text:='';

form3.Edit3.Text:='';

form3.Edit4.Text:='';

form3.Edit5.Text:='';

form3.ComboBox1.Text:='Bölüm Seçiniz';

form3.RadioButton1.Checked:=true;

form3.Image1.Picture.Assign(nil);

form3.Edit1.SetFocus;

end;

procedure TForm3.Button1Click(Sender: TObject);//FOTO AÇMA

begin

opendialog1.Execute();

yol:=opendialog1.FileName;

image1.Picture.LoadFromFile(yol);

end;

procedure TForm3.Button2Click(Sender: TObject); //KAYIT

var

cins:string;

begin

if radiobutton1.Checked=true then

cins:='Kız'

else cins:='Erkek';

table1.Insert;

table1.FieldByName('num').Text:=edit1.Text;

table1.FieldByName('adsoy').Text:=edit2.Text;

table1.FieldByName('cins').Text:=cins;

table1.FieldByName('bol').Text:=combobox1.Text;

table1.FieldByName('ders').Text:=edit3.Text;

table1.FieldByName('vize').Text:=edit4.Text;

table1.FieldByName('fin').Text:=edit5.Text;

table1.FieldByName('yol').Text:=yol;

table1.Post;

temizle();

end;

procedure TForm3.Button3Click(Sender: TObject);//ARAMA

begin

table1.First;

while not table1.Eof do

begin

if table1.FieldByName('num').Text=edit1.Text then

begin

edit1.Text:=table1.FieldByName('num').Text;

edit2.Text:=table1.FieldByName('adsoy').Text;

if table1.FieldByName('cins').Text='Kız' then

radiobutton1.Checked:=true

else radiobutton2.Checked:=true;

combobox1.Text:=table1.FieldByName('bol').Text;

edit3.Text:=table1.FieldByName('ders').Text;

edit4.Text:=table1.FieldByName('vize').Text;

edit5.Text:=table1.FieldByName('fin').Text;

image1.Picture.LoadFromFile(table1.FieldByName('yol').Text);

end;

table1.Next;

end;

end;

procedure TForm3.Button4Click(Sender: TObject); //SİLME

begin

table1.Delete;

table1.Prior;

temizle();

end;

procedure TForm3.Button5Click(Sender: TObject); //DÜZELTME

var

cins:string;

begin

table1.Edit;

if radiobutton1.Checked=true then

cins:='Kız'

else cins:='Erkek';

table1.FieldByName('num').Text:=edit1.Text;

table1.FieldByName('adsoy').Text:=edit2.Text;

table1.FieldByName('cins').Text:=cins;

table1.FieldByName('bol').Text:=combobox1.Text;

table1.FieldByName('ders').Text:=edit3.Text;

table1.FieldByName('vize').Text:=edit4.Text;

table1.FieldByName('fin').Text:=edit5.Text;

table1.FieldByName('yol').Text:=yol;

table1.UpdateRecord();

table1.Prior;

temizle();

end;

procedure TForm3.Button6Click(Sender: TObject); // TEMİZLEME BUTONU

begin

temizle();

end;

procedure TForm3.Button7Click(Sender: TObject); //ÇIKIŞ

begin

self.Close;

end;

end.

0 yorum:

Yorum Gönder

 
Powered by: Alone