Deploy report via code
-
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
-
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