Delphi-Quellcode:
procedure TClerkBox.BeforeDestruction;
begin
if FChanged then
begin
if FDataSetID <> -1 then
UpdateEntry
else
InsertEntry;
end;
inherited BeforeDestruction;
end;
procedure TClerkBox.UpdateEntry;
begin
if FChanged then
begin
FMySQL.Query('UPDATE staff SET name='''+txt_clerkname.Text+''' WHERE id='+inttostr(FDataSetID));
if FMysql.LastErrorNo <> 0 then
showmessage(FMySQL.LastErrorMsg);
FMySQL.FreeResult(FMySQL.LastResultID);
FChanged := false;
Caption := 'Information:';
SchedClerks.LoadClerks;
end;
end;
procedure TClerkBox.InsertEntry;
begin
if FChanged then
begin
FMySQL.Query('INSERT INTO staff (name) VALUES('''+txt_clerkname.text+''')');
if FMysql.LastErrorNo <> 0 then
showmessage(FMySQL.LastErrorMsg);
FMySQL.FreeResult(FMySQL.LastResultID);
FChanged := false;
Caption := 'Information:';
SchedClerks.LoadClerks;
end;
end;
wie gesagt, es hat sich im grunde nichts geändert
das ganze läuft nach wie vor nicht