Hi, Dear All,
I have the same problem when I tried to use setDataSource method.
Here is my code:
Dim reference As New DataSourceReference
reference.Reference = "/xxxx/" + DBName
Dim dataSources(1) As DataSource
Dim ds As New DataSource
ds.Item = CType(reference, DataSourceDefinitionOrReference)
ds.Name = DBName
dataSources(0) = ds
' Render arguments
Dim reportPath As String = "/xxx/yyy" +
Request.Params("NumberOfT").ToString()
Dim format As String = "PDF"
Dim historyID As String = Nothing
Dim devInfo As String = "<DeviceInfo><Toolbar>False</Toolbar></DeviceInfo>"
' Prepare report parameter.
Dim parameters(1) As ParameterValue
parameters(0) = New ParameterValue
parameters(0).Name = "ReportID"
parameters(0).Value = Request.Params("ReportID").ToString()
parameters(1) = New ParameterValue
parameters(1).Name = "xxx"
parameters(1).Value = Request.Params("xxx").ToString()
Dim rs As New ReportingService
rs.Credentials = System.Net.CredentialCache.DefaultCredentials
rs.SessionHeaderValue = New SessionHeader
rs.SetReportDataSources(reportPath, dataSources) (error happend here)
Actually, I copied it from MSDN sample. I did not see how the DataSources(1)
could be set. Do I need to set DataSources(1)?
Thanks,
Henry
[quoted text, click to view] "Lev Semenets [MSFT]" <levs@microsoft.com> wrote in message
news:%23f6R1FwkEHA.1652@TK2MSFTNGP09.phx.gbl...
> where is a value for dsList(0) ?
>
> --
> This posting is provided "AS IS" with no warranties, and confers no
> rights.
>
>
> "CalinV" <CalinV@discussions.microsoft.com> wrote in message
> news:631AD51F-0AD1-4B7A-8C3A-47CE0264A5D5@microsoft.com...
>>I am having the following problem:
>> I have a shared data source and a report on the server.
>> I want to change the data source of the report programmatically but I am
>> receiving the following error:
>> "The required field DataSource is missing from the input structure"
>> I am using the following code:
>> Dim reference As New ReportServer.DataSourceReference
>> reference.Reference = "/MyDS"
>>
>> Dim dss As New ReportServer.DataSource
>>
>> dss.Item = CType(reference,
>> ReportServer.DataSourceDefinitionOrReference)
>> dss.Name = "MyDS"
>> Dim dsList() As ReportServer.DataSource = New
>> ReportServer.DataSource(1){}
>> dsList(1) = dss
>> dsList(1).Name = "MyDS"
>> rs.SetReportDataSources("/Test report1", dsList)
>>
>> The shared datasource and the report are on the root directory and the
>> report was created with a shared datasource with the name "MyDS"
>> What could be the problem?
>>
>>
>
>