Changing database server (hostname) at runtime

I am trying to change the hostname of my database server (stored in the params property of the DBXDatabase component in the report) at runtime. Can I do this from within delphi? What I need to do is run one report on potentially multiple different sql servers.

Comments

  • edited 9:54AM
    You can try :

    IN Delphi, you create a variable for the report with the connectionstring (sTemp here) for your base :

    frReport1.Dictionary.Variables := '''' + sTemp + '''';

    IN the report you have DATABase1 as a tfrADODataBase
    Insert in the 'onActivate' script :

    if [sConnexionString] <> '' then
    DATABase1.databaseName :=[sConnexionString];


    OK ?

  • edited 9:54AM
    Thanks - but am using dbexpress
    So, in the TfrDBXDatabase component, I need to change a variable in the
    Params property - is there a way of changing only one variable in this property (and leaving the rest the same)?

  • same problem for me too ....

    it seems too strange that it can't be done

  • You can access to TfrxDBXDatabase.Params (this is TStrings) from Delphi

    TfrxDBXDatabase(frxReport1.FindObject('DBXDatabase1')).Params.Strings[n] := 'YourNewValue';

Leave a Comment