Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Deploy report via code

Deploy report via code

Scheduled Pinned Locked Moved ASP.NET
databasesysadminquestion
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    mehrdadc48
    wrote on last edited by
    #1

    Hi everybody, I've written this code for publish reports on ReportServer.Everything is ok, but if I have SharedDataSource it says: --------------------------- The dataset ‘NewDT’ refers to the shared data source ‘NewDT’, which is not published on the report server. --------------------------- what's wrong?

    Dim TmpEncoding As New System.Text.UTF8Encoding
    Dim TmpReportDefinition() As Byte = TmpEncoding.GetBytes(PRdl)

        Dim TmpWarnings() As Warning = TmpRsProxy.CreateReport(PReportName, PParentPath, True, TmpReportDefinition, Nothing)
    
        Dim TmpDataSources As DataSource() = TmpRsProxy.GetItemDataSources(PParentPath & "/" & PReportName)
    
        For Each TmpDataSource As DataSource In TmpDataSources
    
            Dim dSource As New DataSource
            Dim dDefinition As New DataSourceDefinition()
            dSource.Item = dDefinition
            dDefinition.Extension = "Sql"
            dDefinition.ConnectString = "Data Source=" + ClsSetting.DbServerName + ";Initial Catalog=" + ClsSetting.DbName
            dDefinition.ImpersonateUserSpecified = True
            dDefinition.Prompt = Nothing
            dDefinition.WindowsCredentials = True
            dDefinition.CredentialRetrieval = CredentialRetrievalEnum.Integrated
            dSource.Name = TmpDataSource.Name
    
            Try
    
                TmpRsProxy.CreateDataSource(dSource.Name, ClsSetting.DataSourceLocation, True, dDefinition, Nothing)
    
                If TypeOf (TmpDataSource.Item) Is DataSourceReference Then
    
                    Dim DsReference As New DataSourceReference()
                    Dim ds As New DataSource
                    DsReference.Reference = ClsSetting.DataSourceLocation + "/" + dSource.Name
                    Dim DataSources() As DataSource = TmpRsProxy.GetItemDataSources(PParentPath & "/" & PReportName)
                    ds = DataSources(0)
                    ds.Item = CType(DsReference, DataSourceReference)
                    ds.Name = TmpDataSource.Name
                    TmpRsProxy.SetItemDataSources(PParentPath + "/" + PReportName, DataSources)
                End If
    
            Catch ex As System.Web.Services.Protocols.SoapException
                Throw ex
            End Try
        Next
    

    </pre>

    Best wishes

    S 1 Reply Last reply
    0
    • M mehrdadc48

      Hi everybody, I've written this code for publish reports on ReportServer.Everything is ok, but if I have SharedDataSource it says: --------------------------- The dataset ‘NewDT’ refers to the shared data source ‘NewDT’, which is not published on the report server. --------------------------- what's wrong?

      Dim TmpEncoding As New System.Text.UTF8Encoding
      Dim TmpReportDefinition() As Byte = TmpEncoding.GetBytes(PRdl)

          Dim TmpWarnings() As Warning = TmpRsProxy.CreateReport(PReportName, PParentPath, True, TmpReportDefinition, Nothing)
      
          Dim TmpDataSources As DataSource() = TmpRsProxy.GetItemDataSources(PParentPath & "/" & PReportName)
      
          For Each TmpDataSource As DataSource In TmpDataSources
      
              Dim dSource As New DataSource
              Dim dDefinition As New DataSourceDefinition()
              dSource.Item = dDefinition
              dDefinition.Extension = "Sql"
              dDefinition.ConnectString = "Data Source=" + ClsSetting.DbServerName + ";Initial Catalog=" + ClsSetting.DbName
              dDefinition.ImpersonateUserSpecified = True
              dDefinition.Prompt = Nothing
              dDefinition.WindowsCredentials = True
              dDefinition.CredentialRetrieval = CredentialRetrievalEnum.Integrated
              dSource.Name = TmpDataSource.Name
      
              Try
      
                  TmpRsProxy.CreateDataSource(dSource.Name, ClsSetting.DataSourceLocation, True, dDefinition, Nothing)
      
                  If TypeOf (TmpDataSource.Item) Is DataSourceReference Then
      
                      Dim DsReference As New DataSourceReference()
                      Dim ds As New DataSource
                      DsReference.Reference = ClsSetting.DataSourceLocation + "/" + dSource.Name
                      Dim DataSources() As DataSource = TmpRsProxy.GetItemDataSources(PParentPath & "/" & PReportName)
                      ds = DataSources(0)
                      ds.Item = CType(DsReference, DataSourceReference)
                      ds.Name = TmpDataSource.Name
                      TmpRsProxy.SetItemDataSources(PParentPath + "/" + PReportName, DataSources)
                  End If
      
              Catch ex As System.Web.Services.Protocols.SoapException
                  Throw ex
              End Try
          Next
      

      </pre>

      Best wishes

      S Offline
      S Offline
      Sun Rays
      wrote on last edited by
      #2

      Hey, here is one solution you may need the same. Try it[^]

      Thanks, Sun Rays To get something you must have to try once. My Articles

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups