Hallo MrSpock...
Einfach mal ein Beispiel an dem du das alles siehst...
Delphi-Quellcode:
procedure TdAV_Database_FB.Save(Employee: TdAV_PlantEmployee);
var
Query: TIBCQuery;
begin
Query:= CreateInterfacedQuery;
case Employee.State
of
dsNew:
begin
Query.SQL.Text:= '
insert into T_PLANT_EMPLOYEES (F_PLANT_ID,F_EMPLOYEE_NUMBER, F_FIRST_NAME, F_NAME,F_CERTIFICATION) values ';
Query.SQL.Add('
(:PID,:EMN,:FNA,:LNA,:CER) returning ID');
Query.ParamByName('
PID').AsInteger:= Employee.PlantID;
Query.ParamByName('
FNA').AsString:= Employee.FirstName;
Query.ParamByName('
LNA').AsString:= Employee.
Name;
Query.ParamByName('
EMN').AsString:= Employee.PersonalNumber;
Query.ParamByName('
CER').AsString:= Employee.Certification;
Query.ExecSQL;
Employee.ID:=
Query.ParamByName('
RET_ID').AsInteger;
end;
dsModified:
begin
Query.SQL.Text:= '
update T_PLANT_EMPLOYEES set F_EMPLOYEE_NUMBER = :EMN,F_FIRST_NAME = :FNA,F_NAME = :LNA, F_CERTIFICATION= :CER where ID = :ID';
Query.ParamByName('
ID').AsInteger:= Employee.ID;
Query.ParamByName('
FNA').AsString:= Employee.FirstName;
Query.ParamByName('
LNA').AsString:= Employee.
Name;
Query.ParamByName('
EMN').AsString:= Employee.PersonalNumber;
Query.ParamByName('
CER').AsString:= Employee.Certification;
Query.ExecSQL;
end;
dsDeleted:
begin
Query.SQL.Text:= '
delete from T_PLANT_EMPLOYEES where ID = :ID';
Query.ParamByName('
ID').AsInteger:= Employee.ID;
Query.ExecSQL;
end;
end;
end;
...sorry für die doppelte Lösung. Zu spät.