Home General
New Blog Posts: Merging Reports - Part 1 and Part 2

DefaultADOCOnnection - BIG problem

edited June 2003 in General
Hi,
We have a number of reports that were designed by an artist using a
standalone reporting application built with reportBuilder.
Now we are wanting to assign these predefined reports to the menu of the
main application and find that it is impossible to launch them - it asks
for a login to "defaultADOConnection", even having the ADO connection to
the relevant database present in the main application.
Please indicate what can be done to fix this serious problem. It should
be easy to save reports to file and use them in other applications
provided a connection to the right database was supplied.
Thank you for a prompt reply
Philippe

Comments

  • edited June 2003
    Philippe,

    When ReportBuilder tries to make a connection, it will look for the database
    it was built with. If it cannot find the correct one, it will create a
    default ADO connection and use that. You need to be sure that the database
    defined for your dataviews is correct and matches the reports. Also, see if
    you can create a new dataview at runtime to test that your datasettings are
    working correctly and you are able to connect to you database ok.

    --
    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited June 2003
    Affirmative - not only is there a valid connection, but is has the same
    name as the prior one and it works fine. CReating a new dataview at
    runtime is quite possible. Obviously, this can be time-consuming for
    lengthy queries and therefore I would rather not have to rewrite all my
    queries! We are talking about 4 to 5 table joins with multiple selected
    fields and multiple calculations each time.

  • edited June 2003
    Hi,

    I use the following function that is called from the OnLoadEnd()
    eventhandler.
    It overwrites the database used in the enduser report application with the
    one I have
    active in my own application. This workes fine for me.

    Regards,
    Jeroen.

    ----------------------------------------------------------------------------
    --------

    function GetSQLObject( aReport: TppReport; var aSQL: TdaSQL ) : Boolean;
    var lDataModule: TdaDataModule;
    lDataView: TdaDataView;
    X : integer;
    begin
    aSQL := nil;
    {get the datamodule}
    lDataModule := daGetDataModule(aReport);

    if (lDataModule <> nil)
    then begin
    for X := 0 to lDataModule.DataViewCount-1
    do begin
    lDataView := lDataModule.DataViews[X];
    if (lDataView <> nil) and (lDataView is TdaQueryDataView)
    then begin
    aSQL := TdaQueryDataView(lDataView).SQL;
    aSQL.DatabaseName := DMDb.IBDatabase.Name; ** replace with your
    database componentNAME
    end;
    end;
    end;
    Result := (aSQL <> nil);
    end;

    ----------------------------------------------------------------------------
    -------

This discussion has been closed.