Database connectivity from application

We decide to buy FastReport, testing features and can't solve a one, but for us very big, problem. We would design datasets within a report, but a database connectivity (TIBDatabase) we can supply from application. Is it possible ???

Thanks for answer

Milan Tomes

Comments

  • edited 1:31AM
    Hi!

    If you mean that you use the internal (IBX based) data access components inside the report file and you wanna share the application's database handle to that internal datasets then the answer is YES. It is possible. This is the most powerful data access method I think. I also use IBX as the connectivity layer in the application and all my reports has several data access components inside the report file. They see the app's TIBDatabase component and can use it without any problem. My apps go this way for 2 and a half year and there is no problem. They also works for FireBird as well until you use any of the FB specific feature.

    Regards:Alex
  • edited 1:31AM
    Hi.
    Yes I mean IBX components (in future IB Objects). Can you send me an example how to do that ??? I didn't wrote that IBDatabase component I create dynamically and there is no parent window so TfrIBXQuery can't see this component. Is there a way to assign Database property of TfrIBXQuery object dynamically in runtime ???
  • edited 1:31AM
    Hi!

    Sorry for the late. Not sure, but maybe work. This is when you don't know the names of the objects. If you know them, you canj use explicitly the Report.FindObject function with a simple type casting to TFrIBXQuery and set the appropriate property.

    Var Q:TFrIBXQuery;
    Begin
    For I:=0 to R.Pages[0].Objects.Count-1 do
    Begin
    If TClass(R.Pages[0].Objects).ClassName='TFRIBXQuery' then
    Begin
    Q:=TFRIBXQuery(R.Pages[0].Objects);
    Q.Prop:=DynamicDatabase;
    OR Q.Query.Database:=DynamicDatabase;
    End;
    End;
    End;

    Regards:Alex
  • edited 1:31AM
    Thanks a lot for your (not working) example. But this inpired me and here is fully tested and working example:
    var
      i: integer;
    begin
      for i := 0 to Pred(frReport1.Pages[0].Objects.Count) do
      begin
        if TObject(frReport1.Pages[0].Objects[i]).InheritsFrom(TfrIBXQuery) then
          TFRIBXQuery(frReport1.Pages[0].Objects[i]).Query.Database := IBDatabase1;
        if TObject(frReport1.Pages[0].Objects[i]).InheritsFrom(TfrIBXTable) then
          TFRIBXTable(frReport1.Pages[0].Objects[i]).Table.Database := IBDatabase1;
      end;
    end;
    

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.