RDLX and Web.Config

  • jazzolina 1 year, 3 months ago

    We are using RDLX reports and displaying them with the HTML5 Report Viewer in and ASP.NET MVC 5 application. Right now, the connection string for all of the reports is in a RDSX file that all reports point to. This becomes a problem when deploying to PROD vs QA vs UAT environments as they each have a different database and hence database connection string.

    Is there a way to specify the connection string from the Web.config. Please remember that we are using the HTML5 viewer b/c that is all that seems to be supported in an MVC environment.

    If there is any sample code for this, that would be ideal. Thanks!!

    JA

  • 597p
    Reema597p 1 year, 3 months ago

    Hello JA,

    Yes, you can specify the connection string in your WebConfig file. Please refer to the following forum post discussing a similar requirement :

    http://arhelp.grapecity.com/groups/topic/how-to-declare-a-global-connection-string-for-ar/

    Hope that helps.

    Regards,
    Reema

  • jazzolina 1 year, 3 months ago

    Hello Reema,

    I’m sorry, but this does not answer the question I asked at all. I am using the HTML5 viewer to render the reports, not the ASPX Web Viewer control. There is no code that generates the report, it is done by the ActiveReports.ASMX web service.

    This is becoming a critical issue for us.

    Thank you –

    JA

  • 597p
    Reema597p 1 year, 3 months ago

    Hello JA,

    I have been looking into this issue and I think following should work for you :

    - Create a CustomReportService in your application with “HTML5 Report Viewer in and ASP.NET MVC 5 ”
    - Access your report objects in that service and modify/assign the ConnectionString to the report objects as per requirement

    OR,

    like in the link shared earlier, define different ConnectionString keys in your WebConfig corressponding to the reports contained in your application and,

    - then assign these “keys” to the respective report objects in the CustomReportService code behind.

    Refer to the sample demonstrating the same for your reference :

    https://www.dropbox.com/s/55xhvb4wcy60q7t/GrapeCity%20ActiveReports%20-%20AR_HTML5Viewer_MVC.zip?dl=0

    (For different report objects in the application; rdlx, rpx, *.cs reports; you can modify the ConnectionString in the CustomReportService code-behind)

    Hope that helps.

    Regards,
    Reema

  • jazzolina 1 year, 3 months ago

    Reema — that is helpful, it points us in the right direction. We’re working on implementing this and I’ll update here with the result when it’s done.

  • 597p
    Reema597p 1 year, 3 months ago

    Hello,

    Glad to know that.
    Please feel free to revert at your convenience.

    Regards,
    Reema

  • MeSreejesh 2 months ago

    Hi Reema,

    We having a same scenario and I would like to check the sample solution you provided in the link , but it seems to be a broken link.

    https://www.dropbox.com/s/55xhvb4wcy60q7t/GrapeCity%20ActiveReports%20-%20AR_HTML5Viewer_MVC.zip?dl=0

    Any help?

    Thanks,

    Sreejesh

  • 195p
    AbdiasM195p 2 months ago

    Hi Sreejesh,

    I have attached the modified sample application to set the connectionstring of the RDLX report at runtime in the CustomReportService.

    PageReport rptRdl = new PageReport(new FileInfo(Server.MapPath(“~/Reports/RdlReport1.rdlx”)));
     var conn = @”data source=C:\Users\username\Documents\GrapeCity Samples\ActiveReports 11\Data\NWIND.mdb;provider=Microsoft.Jet.OLEDB.4.0;”;
     rptRdl.Report.DataSources[0].ConnectionProperties.ConnectString = conn;                    
    
     return rptRdl;

    Hope it helps

  • lari3008 2 months ago

    Hi,

    i have the same issue but i am using an object provider (list). i have 2 list at the moment they are to be display in an rdl report.

    protected override object OnCreateReportHandler(string reportPath)
            {
    
               switch (reportPath)
                {
    
                    case "Reports/RdlReport.rdlx":
    
                        PageReport rptRdl = new PageReport(new FileInfo(Server.MapPath("Reports/RdlReport.rdlx")));
                        rptRdl.Document.LocateDataSource += Document_LocateDataSource;
    
                        return rptRdl; 
    
    
    private void Document_LocateDataSource(object sender, LocateDataSourceEventArgs args)
            {
                if (args.DataSetName == "myCustomer")        
                {
    
                 
                    List<mycustomer> data = myCustomer.GetCust();
                    args.Data = data;
    
                }
                else if (args.DataSetName == "myAlacerReport")  
                {
    
                    List<myalacerreport> data = myAlacerReport.GetData();
                    args.Data = data;
    
                }

    please help. this is really critical for my company at the moment.

  • 195p
    AbdiasM195p 1 month, 4 weeks ago

    I have answered your query on your other post (http://arhelp.grapecity.com/groups/topic/connection-to-multiple-dataset-used-by-the-same-report/). Kindly check

Viewing 10 posts - 1 through 10 (of 10 total)

You must be logged in to reply to this topic.