Kod: Tümünü seç
procedure TFrm_kullgrupkayit.Edit1Exit(Sender: TObject);
var
editsakla:string;
kayitbul:string;
begin
if edit1.Text<>'' then
begin
dmuser.kayitbulq.Close;
dmuser.kayitbulq.SQL.Clear;
dmuser.kayitbulq.SQL.Add('SELECT * FROM TBLUSERGRUPKODU');
dmuser.kayitbulq.SQL.Add('WHERE GRUP_KODU ='+QuotedStr(Edit1.Text)+'');
dmuser.kayitbulq.Open;
kayitbul:=Trim(dmuser.kayitbulq.fieldbyname('GRUP_KODU').AsString);
if kayitbul<>'' then
begin
dmuser.TBLUSERGRUPKODU.Locate('GRUP_KODU',kayitbul,[]);
dmuser.TBLUSERGRUPKODU.Edit;
edit2.Text:=dmuser.TBLUSERGRUPKODUGRUP_ADI.AsString;
ComboBox1.Text:=dmuser.TBLUSERGRUPKODUAKTIF_MI.Text;
end
else
begin
dmuser.TBLUSERGRUPKODU.Append;
end;
end
else
begin
beep;
edit1.SetFocus;
end;
with(sender as Tedit)do
color:=clbtnface;
end;
Kod: Tümünü seç
procedure TFrm_kullgrupkayit.ComboBox1Exit(Sender: TObject);
begin
if dmuser.TBLUSERGRUPKODU.State = dsInsert then
begin
dmuser.TBLUSERGRUPKODUGRUP_KODU.AsString:=Edit1.Text;
dmuser.TBLUSERGRUPKODUGRUP_ADI.AsString := edit2.Text;
dmuser.TBLUSERGRUPKODUAKTIF_MI.AsString := ComboBox1.Text;
dmuser.TBLUSERGRUPKODU.Post;
edit1.Clear;
edit2.Clear;
ComboBox1.Clear;
edit1.SetFocus;
end;
if dmuser.TBLUSERGRUPKODU.State = dsEdit then
begin
dmuser.TBLUSERGRUPKODUGRUP_KODU.AsString := edit1.Text;
dmuser.TBLUSERGRUPKODUGRUP_ADI.AsString := Edit2.Text;
dmuser.TBLUSERGRUPKODUAKTIF_MI.AsString := ComboBox1.Text;
dmuser.TBLUSERGRUPKODU.UpdateRecord;
dmuser.TBLUSERGRUPKODU.Post;
dmuser.TBLUSERGRUPKODU.Refresh;
edit1.Clear;
edit2.Clear;
ComboBox1.Clear;
edit1.SetFocus;
end;