Hello,
i have a form with IBConnection,SQLQuery,SQLTransaction,DataSource and a DBGrid. With the first Button i fill the Grid with the Data´s here is the Code:
procedure TForm1.btnanzeigeClick(Sender: TObject);
begin
dbmain.Close;
dbmain.Open;
if dbmain.Connected=true then
begin
dbmain.Connected:=false;
end;
dbmain.Connected:=true;
qrmain.Close;
qrmain.SQL.Text:='SELECT ID,Lager,Artikel,Menge_soll,Menge_Ist,Kommentar,Erfasser,Status,Datum,Uhrzeit From Korrekturen;';
qrmain.Open;
qrmain.Refresh;
end;
With the second Button i want to change the Status from "Antrag" to "Erledigt" from the actually dataset. I found some Codesnippets and so my Code look like this:
procedure TForm1.Button1Click(Sender: TObject);
var nr,stat:string;
begin
nr:=qrmain.FieldByName('ID').AsString;
showmessage(nr);
dbmain.Close;
dbmain.Open;
trmain.StartTransaction;
qrmain.Close;
qrmain.SQL.Clear;
qrmain.SQL.text:='UPDATE Korrekturen SET Status=:Status where ID=:ID;';
qrMain.params.ParamByName('Status').AsString:='Erledigt';
qrMain.params.ParamByName('ID').AsString:=nr;
qrmain.ExecSQL;
trmain.commit;
trmain.EndTransaction;
end;
But it doesn´t works.
Ati