[SOLVED]how can i edit databank fildes with zeos ?? lazarus / 16-Databases ---------------------------------------------------------------------- majid.ebru · 2017-05-21 18:48 Hi after i see this clip i build a databank and write a data into databank. but now i want to edit(updata) some fildes of bank with zeos. can anybody help (and guide) me ?? ---------------------------------------------------------------------- marsupilami79 · 2017-05-21 19:25 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: Code: [Select]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: Code: [Select]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 ---------------------------------------------------------------------- majid.ebru · 2017-05-22 12:21 thanks Quote from: marsupilami79 on May 21, 2017, 09:25:38 pm Code: [Select]ZQuery.Edit; try   ZQuery.FieldByName('x').asString := 'a';   ZQuery.FieldByName('y').asnteger := 5;   ZQuery.Post; except   ZQuery.Cancel;   raise; end; it is very good but which row do you edit that?! . my bank has for example 10 rows. how can i edit(updata) 10th row? or . i want to edit my row click on dbgrid? . i want to edit(updata) 5th row? . how can i edit(updata) 5th row? ---------------------------------------------------------------------- majid.ebru · 2017-05-23 02:50 for example : how can i edit 4th row? . thank you ---------------------------------------------------------------------- majid.ebru · 2017-05-23 21:47 Hi please help me i know that i am beginner and my question is very very Primary , but i need answer . thanks a lot ---------------------------------------------------------------------- SunyD · 2017-05-23 22:38 Quote from: marsupilami79 on May 21, 2017, 09:25:38 pmHello, 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: Code: [Select]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: Code: [Select]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_Tutorial1 I 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. ---------------------------------------------------------------------- majid.ebru · 2017-05-23 23:03 thank you very much ---------------------------------------------------------------------- miab3 · 2017-05-24 08:00 Quote from: Soner A. on May 24, 2017, 12:38:45 amTDataset (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. or TDataset.MoveBy(+-z) Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i ZQuery1.First;ZQuery1.MoveBy(5);ZQuery1.Edit;//...ZQuery1.Post; // or ZQuery1.Next; //// orZQuery1.Insert;//...ZQuery1.Post; //// orZQuery1.Delete;in AutoCommit mode. Michal ---------------------------------------------------------------------- majid.ebru · 2017-05-24 12:12 Quote from: miab3 on May 24, 2017, 10:00:25 amQuote from: Soner A. on May 24, 2017, 12:38:45 amTDataset (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. or TDataset.MoveBy(+-z) Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i ZQuery1.First;ZQuery1.MoveBy(5);ZQuery1.Edit;//...ZQuery1.Post; // or ZQuery1.Next; //// orZQuery1.Insert;//...ZQuery1.Post; //// orZQuery1.Delete;in AutoCommit mode. Michal thank you very much