Forum > Databases

ZeosDbo TZUpdate error operation is not allow for closed Dataset

(1/2) > >>

eldonfsr:
Hi friend some body can help me i don't know why i have query with sql from table but when i update the table or query send me error Operation is not allow for closet DataSet, Table is open query is open...
just on Post method...

this in ZUpdatePo ModifySql
UPDATE PO1_PurchaseOrderEntryHeader SET
PurchaseOrderDate = :PurchaseOrderDate ,
OrderType = :OrderType ,
MasterRepeatingPOOrSO= :MasterRepeatingPOOrSO,
Division=:Division
WHERE PurchaseOrderNumber = :PurchaseOrderNumber
AND DIVISION =:DIVISION



--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---    with ZUpdatePo.Params do begin       ZUpdatePo.Params.ParamByName('PurchaseOrderDate').AsString:='``{d''2024-03-07''}``';       ZUpdatePo.Params.ParamByName('OrderType').AsString:='S';       ZUpdatePo.Params.ParamByName('MasterRepeatingPOOrSO').AsString:='O-S';       ZUpdatePo.Params.ParamByName('PurchaseOrderNumber').AsString:='A39173      ';       ZUpdatePo.Params.ParamByName('DIVISION').AsString:='02';     end;    ZQBrwPo.Edit;    ZQBrwPo.Post;    Try      ZQBrwPo.ApplyUpdates;    except      ZQBrwPo.CancelUpdates;      ShowMessage('Not  update purchase order.');    end;    ZQBrwPo.Refresh;   

Soner:
First check if the connection is active, then do this:

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---   if not ZUpdatePo.Connection.Active  then ShowMessage('Connection not active!'); //for test   ZUpdatePo.Active:=false;  // <-- !    with ZUpdatePo.Params do begin       ZUpdatePo.Params.ParamByName('PurchaseOrderDate').AsString:='``{d''2024-03-07''}``';       // ... and other params...     end;    Try     ZQBrwPo.ExecSql; //<-- !     ZQBrwPo.ApplyUpdates;    except      ZQBrwPo.CancelUpdates;      ShowMessage('Not  update purchase order.');    end;    ZQBrwPo.Refresh;   

eldonfsr:
Thanks so much great tip....

Soner:
Yesterday I forgot to tell you that you only need edit/post with data-controls and your query must be active before calling edit/post.
Without data-controls TZQuery.ExecSql for edit/insert data and TZQuery.Open or "TZQuery.Active:=true;"  for "select" querries.

eldonfsr:
Soner what version of zeos you are using, because i have 8.0 but don't show up property connection on TzUpdatde, could be on previous version.... i don't use seoz before is my first time working with zeos...

and examples look simples but when run test some changes was made and don't run...

Thanks for you comments and help..
 

Navigation

[0] Message Index

[#] Next page

Go to full version