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 6:34PM
    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 6:34PM
    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

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.