Recent

Author Topic: ZeosDbo TZUpdate error operation is not allow for closed Dataset  (Read 2309 times)

eldonfsr

  • Hero Member
  • *****
  • Posts: 526
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  [Select][+][-]
  1.     with ZUpdatePo.Params do begin
  2.        ZUpdatePo.Params.ParamByName('PurchaseOrderDate').AsString:='``{d''2024-03-07''}``';
  3.        ZUpdatePo.Params.ParamByName('OrderType').AsString:='S';
  4.        ZUpdatePo.Params.ParamByName('MasterRepeatingPOOrSO').AsString:='O-S';
  5.        ZUpdatePo.Params.ParamByName('PurchaseOrderNumber').AsString:='A39173      ';
  6.        ZUpdatePo.Params.ParamByName('DIVISION').AsString:='02';
  7.      end;
  8.     ZQBrwPo.Edit;
  9.     ZQBrwPo.Post;
  10.     Try
  11.       ZQBrwPo.ApplyUpdates;
  12.     except
  13.       ZQBrwPo.CancelUpdates;
  14.       ShowMessage('Not  update purchase order.');
  15.     end;
  16.     ZQBrwPo.Refresh;
  17.  
 

Soner

  • Sr. Member
  • ****
  • Posts: 311
Re: ZeosDbo TZUpdate error operation is not allow for closed Dataset
« Reply #1 on: May 24, 2024, 09:32:36 pm »
First check if the connection is active, then do this:
Code: Pascal  [Select][+][-]
  1.    if not ZUpdatePo.Connection.Active  then ShowMessage('Connection not active!'); //for test
  2.    ZUpdatePo.Active:=false;  // <-- !
  3.     with ZUpdatePo.Params do begin
  4.        ZUpdatePo.Params.ParamByName('PurchaseOrderDate').AsString:='``{d''2024-03-07''}``';
  5.        // ... and other params...
  6.      end;
  7.     Try
  8.      ZQBrwPo.ExecSql; //<-- !
  9.      ZQBrwPo.ApplyUpdates;
  10.     except
  11.       ZQBrwPo.CancelUpdates;
  12.       ShowMessage('Not  update purchase order.');
  13.     end;
  14.     ZQBrwPo.Refresh;
  15.  
  16.  

« Last Edit: May 24, 2024, 09:50:07 pm by Soner »

eldonfsr

  • Hero Member
  • *****
  • Posts: 526
Re: ZeosDbo TZUpdate error operation is not allow for closed Dataset
« Reply #2 on: May 25, 2024, 03:59:49 am »
Thanks so much great tip....

Soner

  • Sr. Member
  • ****
  • Posts: 311
Re: ZeosDbo TZUpdate error operation is not allow for closed Dataset
« Reply #3 on: May 25, 2024, 11:13:51 am »
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

  • Hero Member
  • *****
  • Posts: 526
Re: ZeosDbo TZUpdate error operation is not allow for closed Dataset
« Reply #4 on: May 26, 2024, 02:29:23 am »
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..
 

Soner

  • Sr. Member
  • ****
  • Posts: 311
Re: ZeosDbo TZUpdate error operation is not allow for closed Dataset
« Reply #5 on: May 27, 2024, 08:02:00 pm »
Sorry it is my fault, it should be:

Code: Pascal  [Select][+][-]
  1. if not ZQBrwPo.Connection.Active  then ShowMessage('Connection not active!'); //for test
  2.  

I'm still using version 7.2.4-stable.



 

TinyPortal © 2005-2018