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

Reportbuilder connection to DBase via ADO?

edited August 2010 in End User
As part of my experimentation to get access to DBase tables without the use
of the BDE I've managed to connect to some tables via ADO. (I've posted a
similar thread relating to Dbase and DbExpress, apologies if they should
have been merged into one thread)

Is it possible to use ADO and DBase together with RB? I've been playing
around with one of the RB demos (the demo is found
in..\RBuilder\Demos\4.EndUser Databases) by adding an additional
TADOConnection that is setup to use the below connection string and I can
open the connection fine.

Driver={Microsoft dBASE Driver (*.dbf)};DriverID=277;Dbq=c:\temp

I've then modified the demo to add the following settings.

with ppDesigner1.DataSettings do
begin
SessionType := ADOSession;
DatabaseName := ADOConnection;
DatabaseType := dtOther;
end;

Launching the report designer and creating a new report, I cannot see any of
the tables. Clicking the 'New' menu item from the Data tab results in a
empty dialog being displayed. Opening the Data settings dialog, the three
combos for Session and Database Type and not populated and are not available
to be selected.

Am I doing something wrong (Highly likely) and is there anything I can do to
resolve this? I really need a solution to opening tables without the BDE and
I'm struggling :(

Many thanks,

Chris.

Comments

  • edited August 2010
    Hi Chris,

    Please refer to my response to your previous post. If you are able to
    successfully connect to your DBase data using DBX or ADO components in
    Delphi, then you should be able to do so using ReportBuilder. The DADE
    plugins simply take the legwork out by creating all the necessary DBX or ADO
    components automatically.

    --
    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited August 2010
    Hi Nico,

    Thanks for taking time to reply :)

    my connections are working as I can confirm I can see records in a dbgrid
    etc but my lack of RB knowledge is letting me down as this App conversion is
    my fist time with RB. I apologise in advance for stupid newbie questions ;)

    I've been playing around with the interbase / dbexpress end user demo as
    this is close to our app but I still can't seem to this to work

    the connection euSQLConnection still connects to the Interbase database and
    is unchanged but a second SQLConnection has been added (ADO connection to
    DBase). I want to be able to see the tables in the ADO connection in the
    designer so I've set the details in the ppDesigner.DataSettings as mentioned
    previously with a database type set to dtOther

    When I execute the demo, and click on the lauch button to display the folder
    explorer I get no errors but I create a new report and check the Data
    Settings, none of the ADO connection details are available?

    I still need the joins tables etc to be using the original Interbase
    connection but my data needs to come from the ADO connection.
    Will this setup work as I'm stumped

    Thanks again for your assitance

    Chris Hedges

    btw, I'm using D2007 and RB 10.09




  • edited August 2010
    Apologies, you probably realised but I meant a second TADOConnection was
    added...ooops


  • edited August 2010
    Hi Chris,

    1. Be sure 'daADO' is in your uses clause. This will register the ADO
    plugin at runtime.

    2. Once you open the report designer and tab to the Data workspace, open the
    Data Settings dialog and be sure everything is correct (connected to the
    ADOConnection).

    3. This then should allow you to use the Query Designer or Query Wizard
    (File | New) to access the data.

    We do not have much experience with DBase databases however if you are able
    to successfully connect to it via ADO in Delphi, the DB type should not
    matter. RB simply deals with the ADO components.

    Do you know if there is a trial or freeware version of DBase available? If
    so I could install it on my machine and work through the example with you.
    Looking at their web site, it does not look like they offer something like
    this.

    --
    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited August 2010
    Ok, I figured out the problem with ADO at least *embarrassed* ;)

    I forgot to enable the ADO compiler directive in the demo........doh!!!!



  • edited August 2010
    Hi Nico,

    Thanks for the reply. I did manage to figure out my first problem being I
    did not include the ADO unit as you mention :)

    I've now run into another issue. My ADO connection is created dynamically
    at runtime and is buried in a class and not on a Datamodule etc and is
    exposed as a property of a class.

    In the End User demo, the designer and connection are both together on a
    form. When setting the session to ADOSession the DatabaseName combo in the
    object inspector already has the correct ADO connection available to be
    selected.
    This works fine and I can access the tables etc.

    Now trying with my class with the dynamically created ADOConnection is not
    so successful. When I open the Datasetting dialog in the designer, the
    connection is not present.

    e.g if I set the Datasettings like so, the ADOconnection will not appear in
    the datasettings of the Editor and the tables are not available.

    Does this mean I *must* put the connection onto a datamodule and cannot be
    created at runtime?

    with ppDesigner1.DataSettings do
    begin
    SessionType := ADOSession;
    DatabaseName := myClass.ADOConnection.Name; //name is set to something ;)
    DatabaseType := dtOther;
    end;


  • edited August 2010
    Hi Chris,

    By default, ReportBuilder relies on all connection objects being owned by a
    form or datamodule in the project to use them in DADE. The easiest way to
    get this working would be to place or create a new TADOConnection object
    that is owned by one of the forms in your project.

    If you must use the existing connection object, the architecture of DADE
    allows connection process to easily be customized using the DADE plugins.

    In your case you are using the daADO plugin located inside the daADO.pas
    file. If you open and take a look at this file, you will see the
    TdaADOSession object which handles all ADOConnection manipulation. Inside
    the TdaADOSession.GetDatabaseNames routine, you will want to remove the
    inherited call and populate the list yourself. This will be the list
    displayed in the DataSettings dialog. You will also want to override a
    routine in the ancestor named TdaSession.GetDatabaseForName. This routine
    retrieves the connection object for a given name. You will want to override
    this code with your own that returns the connection object you are using in
    the rest of your app based on the name given.

    --
    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited August 2010
    Thanks Nico!

    Thats very informative :)


This discussion has been closed.