Recent

Author Topic: [SOLVED - Pleas ignore]How to use ApplyUpdates in IBX  (Read 3601 times)

incendio

  • Sr. Member
  • ****
  • Posts: 269
[SOLVED - Pleas ignore]How to use ApplyUpdates in IBX
« on: November 24, 2021, 04:35:35 am »
Hi guys,

Newbie here, I tried to use IBX for my database application.

I have codes declaration like these
Code: Pascal  [Select][+][-]
  1.   TForm1 = class(TForm)
  2.     btnUndo: TButton;
  3.     btnSave: TButton;
  4.     DataSource1: TDataSource;
  5.     Dba: TIBDatabase;
  6.     DBEdit1: TDBEdit;
  7.     DBText1: TDBText;
  8.     Dt: TIBDataSet;
  9.     DtCD: TIBStringField;
  10.     DtGRP: TIBStringField;
  11.     DtID: TIBIntegerField;
  12.     Trs: TIBTransaction;
  13.     procedure btnSaveClick(Sender: TObject);
  14.     procedure btnUndoClick(Sender: TObject);
  15.     procedure FormCreate(Sender: TObject);
  16.   private
  17.  
  18.   public
  19.  
  20.   end;
  21.  

Stuck in this codes
Code: Pascal  [Select][+][-]
  1. procedure TForm1.btnSaveClick(Sender: TObject);
  2. const
  3.   Tbl : array[1..1] of TIBDataSet = (Dt);
  4.  
  5. begin
  6.   Dba.ApplyUpdates(Tbl);
  7. end;
  8.  

got an error
Error: typed constants of classes or interfaces are not allowed


EDIT
Change the code to this, seem fix the problem
Code: Pascal  [Select][+][-]
  1. procedure TForm1.btnSaveClick(Sender: TObject);
  2. var
  3.   Tbl : array [1..1] of TDataSet;
  4.  
  5. begin
  6.   Tbl[1] := Dt;
  7.   Dba.ApplyUpdates( Tbl);
  8. end;  
« Last Edit: November 24, 2021, 06:10:51 am by incendio »

korba812

  • Sr. Member
  • ****
  • Posts: 394
Re: [SOLVED - Pleas ignore]How to use ApplyUpdates in IBX
« Reply #1 on: November 24, 2021, 11:48:42 am »
You can also do it like this:
Code: Pascal  [Select][+][-]
  1. procedure TForm1.btnSaveClick(Sender: TObject);
  2. begin
  3.   Dba.ApplyUpdates([Dt]);
  4. end;

incendio

  • Sr. Member
  • ****
  • Posts: 269
Re: [SOLVED - Pleas ignore]How to use ApplyUpdates in IBX
« Reply #2 on: November 24, 2021, 12:12:17 pm »
You can also do it like this:
Code: Pascal  [Select][+][-]
  1. procedure TForm1.btnSaveClick(Sender: TObject);
  2. begin
  3.   Dba.ApplyUpdates([Dt]);
  4. end;

Nice, thanks for the info.

 

TinyPortal © 2005-2018