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

前端 未结 3 876
离开以前
离开以前 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: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.

提交回复
热议问题