Binding a datasource to a rdl in report server programmatically - SSRS

前端 未结 3 877
离开以前
离开以前 2021-01-21 16:38

I\'ve done a asp.net application to generate reports over a particular data. Initially i created local reports (.rdlc) to generate reports. I created separate .xsd for each rdlc

相关标签:
3条回答
  • 2021-01-21 17:19

    What are you trying to do? I believe the datasource is mentioned within the .RDL file itself. For ex: When you create an Report using BIDS, you can specify the datasource. This gets added to the .RDL file. The same concept holds true here as well.

    0 讨论(0)
  • 2021-01-21 17:24

    This is not impossible, but may take a little effort if this is what you want to do.
    You have a couple of options:

    1. If you create a shared datasource on your report server you can add it manually using the RDLObjectModel. Get the shared datasource name and guid from your reportserver and you can add it to your report.

      Example:

      'create the datasource for the report
      Dim dataSrcRFoo = New RdlObjectModel.DataSource
      dataSrcRFoo.Name = "DataSourceName"
      dataSrcRFoo.DataSourceReference = "/path/to/DataSource"
      dataSrcRFoo.IsShared = True
      dataSrcRFoo.SecurityType = 2 ' RdlObjectModel.SecurityTypeEnum.DataBase   
      dataSrcRFoo.DataSourceID = New Guid("shareddatasourceguid")
      
      'add data source to report
      rdlRpt.DataSources.Add(dataSrcRFoo) 
      
    2. Another option is to use templates on the server that have the share (or report level) datasource built in.

    0 讨论(0)
  • 2021-01-21 17:35

    This work is impossible. you should create your datasource in your rdl report. you must write needed queries for report data gathering. you can use this query as a text or stored procedure. You can pass parameters to this query and filter the output of the query. you can only pass the parameters to rdl report like this:

    ReportParameter[] Params = new ReportParameter[1];
    Params[0] = "Parameter Value";
    ReportViewerControl.ServerReport.SetParameters(Params);
    
    0 讨论(0)
提交回复
热议问题