all groups > sql server reporting services > november 2004 >
You're in the

sql server reporting services

group:

SetReportDataSources


SetReportDataSources Thomas Anderson via SQLMonster.com
11/12/2004 8:24:15 PM
sql server reporting services:
Ok, briefly, here is the issue, I need the ability to change the associated shared datasource with a report on the reporting services server, very similarly the way that the web GUI is handling it without error.

When i execute the following code:

Dim reference As New DataSourceReference
reference.Reference = "/NewDatasource"
Dim dataSources(0) As DataSource
Dim ds As New DataSource
ds.Item = CType(reference, DataSourceDefinitionOrReference)
ds.Name = "NewDatasource"
dataSources(0) = ds

Try
m_rs.SetReportDataSources("/TestReport", dataSources)
Console.WriteLine("New reference set for the report.")

Catch e As system.Web.Services.Protocols.SoapException
Console.WriteLine(e.Detail.InnerXml.ToString())
End Try

It always errors out informing me that the shared datasource is not associated with the report.

So just short of editing the definition of the report using the SetReportDefinition, how can I actually Associate the shared datasource to the report the same way that the web gui does?

Any help on this is greatly appreciated, this is really making me go bald.

*****************************************
* This message was posted via http://www.sqlmonster.com
*
* Report spam or abuse by clicking the following URL:
* http://www.sqlmonster.com/Uwe/Abuse.aspx?aid=0016b55722274271bd8091dab0b3c216
Re: SetReportDataSources Thomas Anderson via SQLMonster.com
11/15/2004 5:59:28 AM
Anyone on this?

*****************************************
* A copy of the whole thread can be found at:
* http://www.sqlmonster.com/Uwe/Forum.aspx/sql-server-reporting/5197
*
* Report spam or abuse by clicking the following URL:
* http://www.sqlmonster.com/Uwe/Abuse.aspx?aid=b87959620d2945fca2d3d27f92ffc91e
RE: SetReportDataSources simon p
1/10/2005 6:55:05 AM
I've got this to work after some trial and error. I thought at first that
the ds.Name referred to the name of the shared datasource on the deployment
server.

However, the clue seems to be in the error message (datasource not
associated with the report). When I modified the report design to use a
shared datasource, and made ds.Name refer to this (the rdl datasource name),
rather than the name of the deployed shared datasource, it worked:

Dim reference As New LocalRS.DataSourceReference
reference.Reference = "/Northwind/dsNorthwindx" 'Deployed Datasource
Dim dataSources(0) As LocalRS.DataSource
Dim ds As New LocalRS.DataSource
ds.Item = CType(reference, LocalRS.DataSourceDefinitionOrReference)
ds.Name = "dsNorthwind" 'RDL Datasource
dataSources(0) = ds

Try
rs = New LocalRS.ReportingService
rs.Credentials = System.Net.CredentialCache.DefaultCredentials

'Deployed Report:
rs.SetReportDataSources("/Northwind/rptNorthwind", dataSources)
Catch ex As System.Web.Services.Protocols.SoapException
Me.lblError.Text = ex.Detail.InnerXml.ToString()
End Try


[quoted text, click to view]
AddThis Social Bookmark Button