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 3:51AM
    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

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.