Hello,
what code do you have already? What works for you and what doesn't work?
Usually you can go two ways:
If you want to update data that you already have loaded into your dataset:
ZQuery.Edit;
try
ZQuery.FieldByName('x').asString := 'a';
ZQuery.FieldByName('y').asnteger := 5;
ZQuery.Post;
except
ZQuery.Cancel;
raise;
end;
If you just want to execute an update statement do something like this:
ZQuery.SQL.Text := 'update table set x = :param_x where y = :param_y';
ZQuery.ParamByName('param_x').asString := 'a';
ZQuery.ParamByName('param_y').asInteger := 5;
ZQuery.ExecSQL;
With best regards,
Jan
This code was right.
TDataset (TZQuery, TSQLQuery is derived from it) shows only one Datarow. It is in TDBGrid marked with arrow (Indiciator column).
If you want edit other data row then you must first move your db-cursor with TDataset.Prior, TDataset.Next or TDataset.locate commands.
I think you need database basics, look at are:
http://wiki.freepascal.org/Lazarus_Database_Overview Follow the tutorials, specially this one
http://wiki.freepascal.org/SQLdb_Tutorial1I would advice you to use built in SQLDB components not the ZEOS components.
SQLDB components have more informations.
Most people like me are using ZEOS only because they come from Delphi and know ZEOS components. SQLDB is future, ZEOS past.