Change programmaticaly the connection string of the report

edited August 2013 in FastReport .NET
Hello
I use the FR .Net with Razor (2013.3).

I'd like to change the connection string programmaticaly but I don't find how.

I tryied the 2 first code in http://www.fast-report.com/public_download...erManual-en.pdf in the "Passing own connection string" chapter.

1) report1.Dictionary.Connections[0].ConnectionString = my_connection_string;

2) the second with the parameter

These 2 code didn't work, and I don't know why.

And finally the third, I didn't found how to change the "EnvironmentSettings component"

Can you help me ?

Regards

Comments

  • edited 9:43AM
    string report_path = Server.MapPath("~//Content//Reports//test.frx");
    webReport.Width = 1000; // set width
    webReport.Height = 1200; // set height
    webReport.LocalizationFile = Server.MapPath("~//Content//Reports//Localizations//Persian.frl");
    webReport.DesignerLocale = "fa";

    webReport.Report.Load(report_path);
    webReport.Report.Dictionary.Connections[0].ConnectionString = domain.ConnectionString;
    return View(webReport);


    you most first "webReport.Report.Load(report_path);" then change "webReport.Report.Dictionary.Connections[0].ConnectionString = YOUR_CONNECTION_STRING;"

Leave a Comment