Thursday, March 8, 2012

Changing programmatically the datasource of a report

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?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?
>|||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
"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?
>>
>|||I think it should be
Dim dataSources(0) As DataSource
instead of
Dim dataSources(1) As DataSource
Please let me know if this works for you.
--
This posting is provided "AS IS" with no warranties, and confers no rights.
"Henry Wang" <wangyh@.gmail.com> wrote in message
news:OhB3Wf3uEHA.3200@.TK2MSFTNGP14.phx.gbl...
> 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
> "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?
>>
>>
>|||On kinda same vien, I generate a RDL with a shared datasource. Once
published, it says the datasource is no longer valid. Any advice?
"Lev Semenets [MSFT]" wrote:
> I think it should be
> Dim dataSources(0) As DataSource
> instead of
> Dim dataSources(1) As DataSource
> Please let me know if this works for you.
> --
> This posting is provided "AS IS" with no warranties, and confers no rights.
>
> "Henry Wang" <wangyh@.gmail.com> wrote in message
> news:OhB3Wf3uEHA.3200@.TK2MSFTNGP14.phx.gbl...
> > 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
> >
> > "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?
> >>
> >>
> >>
> >>
> >
> >
>
>|||Could you email me the code?
--
This posting is provided "AS IS" with no warranties, and confers no rights.
"Eddie" <Eddie@.discussions.microsoft.com> wrote in message
news:AC8BA5F5-2106-4203-9701-FE2AAC528F5F@.microsoft.com...
> On kinda same vien, I generate a RDL with a shared datasource. Once
> published, it says the datasource is no longer valid. Any advice?
> "Lev Semenets [MSFT]" wrote:
>> I think it should be
>> Dim dataSources(0) As DataSource
>> instead of
>> Dim dataSources(1) As DataSource
>> Please let me know if this works for you.
>> --
>> This posting is provided "AS IS" with no warranties, and confers no
>> rights.
>>
>> "Henry Wang" <wangyh@.gmail.com> wrote in message
>> news:OhB3Wf3uEHA.3200@.TK2MSFTNGP14.phx.gbl...
>> > 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
>> >
>> > "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?
>> >>
>> >>
>> >>
>> >>
>> >
>> >
>>|||I got it, phew.
I tried a couple of things, to make sure it wasn't a bug. First I used a
known working RDL template, which uses a shared datasource. I deleted a node
and put it back in and and published it. I went ahead and set the datasource
to the newly published report. That seems to work, but I still wonder why it
doesn't work as seamless as when publishing from the Designer.
"Lev Semenets [MSFT]" wrote:
> Could you email me the code?
> --
> This posting is provided "AS IS" with no warranties, and confers no rights.
>
> "Eddie" <Eddie@.discussions.microsoft.com> wrote in message
> news:AC8BA5F5-2106-4203-9701-FE2AAC528F5F@.microsoft.com...
> > On kinda same vien, I generate a RDL with a shared datasource. Once
> > published, it says the datasource is no longer valid. Any advice?
> >
> > "Lev Semenets [MSFT]" wrote:
> >
> >> I think it should be
> >>
> >> Dim dataSources(0) As DataSource
> >> instead of
> >> Dim dataSources(1) As DataSource
> >>
> >> Please let me know if this works for you.
> >>
> >> --
> >> This posting is provided "AS IS" with no warranties, and confers no
> >> rights.
> >>
> >>
> >> "Henry Wang" <wangyh@.gmail.com> wrote in message
> >> news:OhB3Wf3uEHA.3200@.TK2MSFTNGP14.phx.gbl...
> >> > 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
> >> >
> >> > "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?
> >> >>
> >> >>
> >> >>
> >> >>
> >> >
> >> >
> >>
> >>
> >>
>
>|||Designer does more than just uploading a report.
--
This posting is provided "AS IS" with no warranties, and confers no rights.
"Eddie" <Eddie@.discussions.microsoft.com> wrote in message
news:5960DE8A-37A4-4C62-A886-E8DDD3881F78@.microsoft.com...
>I got it, phew.
> I tried a couple of things, to make sure it wasn't a bug. First I used a
> known working RDL template, which uses a shared datasource. I deleted a
> node
> and put it back in and and published it. I went ahead and set the
> datasource
> to the newly published report. That seems to work, but I still wonder why
> it
> doesn't work as seamless as when publishing from the Designer.
> "Lev Semenets [MSFT]" wrote:
>> Could you email me the code?
>> --
>> This posting is provided "AS IS" with no warranties, and confers no
>> rights.
>>
>> "Eddie" <Eddie@.discussions.microsoft.com> wrote in message
>> news:AC8BA5F5-2106-4203-9701-FE2AAC528F5F@.microsoft.com...
>> > On kinda same vien, I generate a RDL with a shared datasource. Once
>> > published, it says the datasource is no longer valid. Any advice?
>> >
>> > "Lev Semenets [MSFT]" wrote:
>> >
>> >> I think it should be
>> >>
>> >> Dim dataSources(0) As DataSource
>> >> instead of
>> >> Dim dataSources(1) As DataSource
>> >>
>> >> Please let me know if this works for you.
>> >>
>> >> --
>> >> This posting is provided "AS IS" with no warranties, and confers no
>> >> rights.
>> >>
>> >>
>> >> "Henry Wang" <wangyh@.gmail.com> wrote in message
>> >> news:OhB3Wf3uEHA.3200@.TK2MSFTNGP14.phx.gbl...
>> >> > 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
>> >> >
>> >> > "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?
>> >> >>
>> >> >>
>> >> >>
>> >> >>
>> >> >
>> >> >
>> >>
>> >>
>> >>
>>

No comments:

Post a Comment