Page 1 of 1

Strange behaviour after convert to IBDAC

Posted: Sun 17 Apr 2011 09:46
by bzwirs
Hi,

In addition to a few problems experienced with conversion of a project from IBX to IBDAC components I now seem to have a problem which has really stumped me.

Have a form with a lookupcombo and date field and a grid to display data dependent on the selection of the fields mentioned. From the lookupcombo I can select a name of a person and combined with the selected date that persons schedule is displayed. In the lookupcombo and date field's OnCloseUp event I use the following code

Code: Select all

with WeekSchedQry do
  begin
    Close;
    ParamByName('FILLERCODE').asString := sFiller;
    ParamByName('WEEKNUM').asInteger := iWeekNum;
    ParamByName('DAYNUM').asInteger := iDayNum;
    Open;
  end;


My problem is that the form is closed whenever this event is fired. If I step through the code in the IDE...at the end of this procedure it steps directly to the form's OnClose event and I can't seem to see how this can happen. This all worked perfectly fine without any problems with the IBX components. I haven't changed any other code so am assuming this has something to do with the IBDAC component.

Any help would be appreciated.

regards

Bill

Posted: Mon 18 Apr 2011 05:27
by bzwirs
Finally tracked it down to a call in the component's onBeforeClose event. In that event I delete any records that may have been a temporary inclusion in the dataset by a user before re-opening with new parameters. For the deletion of those records I make a call to a TIBCSQL component sitting in my DataModule (StockData) with this code:

Code: Select all

with StockData, MiscSQL do
  begin
    Close;
    with SQL do
    begin
      Clear;
      Add('delete from weeksched');
      Add('where sessioncode = :sessioncode');
    end;
    ParamByName('sessioncode').asString := gKey;
    Execute;
  end;
For some reason this also closes the form. I have now added a TIBCQuery component in the DataModule and named it MISCSQL1. After changeing the code above to MISCSQL1....all works as it should.

Is this a bug in the TIBCSQL component or am I misunderstanding how to use that component. My understanding was that you should use the TIBCSQL component for the above type case (no rows or data to be returned) and the TIBCQuery in cases where rows or data is to be returned.

Bill

Posted: Mon 18 Apr 2011 12:23
by AndreyZ
Hello,

Please try composing a small sample to demonstrate the problem and send it to andreyz*devart*com, including a script to create and fill a table.