From: Paul Cheetham on
Hi,

I have an application in which I want to put a local report.
(VS2005, SSRS 2005, c#)
I have created a typed dataset in my project with the required schema so
that I can design the report as I require it, however I do not want to
use that dataset to get the data, as there is some manipulation I need
to do in code.

What I am trying to do, is create a dataset at run-time and then use
this as the data source for the report.
It sounds easy - it should be easy - but I can't work out how to do it.

I have tried creating a new ReportDataSource, but I can't pass a dataset
or datatable to its constructor. I am unable to assign the contents of
my datatable to the typed dataset as there appears to be no way to do that.

I have been trawling the web all day and can't find anything that tells
me how to do this - hopefully that doesn't mean it can't be done!

Can somebody please point me in the right direction, and tell me how I
can achieve my objective while I still have some hair left?

Thankyou for any help.

Paul
From: Bruce L-C [MVP] on
I think you are confusing design versus runtime. I only briefly played with
local mode. I use the control in server mode. I decided that local mode was
a total pain.

I do know that at run time you give the control the report file name and the
data table (not dataset). So in code you generate the datatable.

What I found easiest and this works because you are using RS 2005 is to
create the report in RS 2005. Rename the rdl file to rdlc. Bring that report
into your project. Much easier to design the report outside of VS 2005.

--
Bruce Loehle-Conger
MVP SQL Server Reporting Services

"Paul Cheetham" <runningdeere(a)NOSPAMamberkeys.co.uk> wrote in message
news:#HwHqPuNKHA.4028(a)TK2MSFTNGP05.phx.gbl...
> Hi,
>
> I have an application in which I want to put a local report.
> (VS2005, SSRS 2005, c#)
> I have created a typed dataset in my project with the required schema so
> that I can design the report as I require it, however I do not want to use
> that dataset to get the data, as there is some manipulation I need to do
> in code.
>
> What I am trying to do, is create a dataset at run-time and then use this
> as the data source for the report.
> It sounds easy - it should be easy - but I can't work out how to do it.
>
> I have tried creating a new ReportDataSource, but I can't pass a dataset
> or datatable to its constructor. I am unable to assign the contents of my
> datatable to the typed dataset as there appears to be no way to do that.
>
> I have been trawling the web all day and can't find anything that tells me
> how to do this - hopefully that doesn't mean it can't be done!
>
> Can somebody please point me in the right direction, and tell me how I can
> achieve my objective while I still have some hair left?
>
> Thankyou for any help.
>
> Paul

From: Paul Cheetham on
Thanks for your reply Bruce

This is the first time I have tried local reporting, as it has always
looked like a lot of trouble to me.
Unfortunately, due to what I am doing, it is not possible to do this any
other way, unless I write the data back to a table in the database which
seems a bit of a ham-fisted way of doing it.

From everything I had seen previously, I should be able to just pass a
datatable to the report.
However there doesn't appear to be a way of doing this.

I have designed the report OK, I just need to figure out how to get my
data into it.

Has anyone used then in this way?


Thankyou

Paul


Bruce L-C [MVP] wrote:
> I think you are confusing design versus runtime. I only briefly played
> with local mode. I use the control in server mode. I decided that local
> mode was a total pain.
>
> I do know that at run time you give the control the report file name and
> the data table (not dataset). So in code you generate the datatable.
>
> What I found easiest and this works because you are using RS 2005 is to
> create the report in RS 2005. Rename the rdl file to rdlc. Bring that
> report into your project. Much easier to design the report outside of VS
> 2005.
>
From: Norman Yuan on
You can look into Localreport.DataSource property. You configure this
property at runtime, something like this:

//Set report datasources
rptViewer.LocalReport.DataSources.Clear();

//Crete a new data source
ReportDataSource theData = new ReportDataSource();

//Set its name the same as the data source name when you design
then
//local report in design mode. When in design mode, you may
create
//a dummy "SELECT..." SQL statement that returns needed
//data columns
theData.Name = "MyData_For_The_Report";

//Assign an DataTable object to the data source
//The datatable has the same columns as the dummy
//SQL query used in report design mode
theData.Value = myDataTable

//Add the new datasource object to the local report
//Of course, a local report could have multiple data sources
rptViewer.LocalReport.DataSources.Add(theData);

//After all data souces are added to the localreport,
rptViewer.RefreshReport();

Hope this helps.

"Paul Cheetham" <runningdeere(a)NOSPAMamberkeys.co.uk> wrote in message
news:%2334HPv3NKHA.5084(a)TK2MSFTNGP04.phx.gbl...
> Thanks for your reply Bruce
>
> This is the first time I have tried local reporting, as it has always
> looked like a lot of trouble to me.
> Unfortunately, due to what I am doing, it is not possible to do this any
> other way, unless I write the data back to a table in the database which
> seems a bit of a ham-fisted way of doing it.
>
> From everything I had seen previously, I should be able to just pass a
> datatable to the report.
> However there doesn't appear to be a way of doing this.
>
> I have designed the report OK, I just need to figure out how to get my
> data into it.
>
> Has anyone used then in this way?
>
>
> Thankyou
>
> Paul
>
>
> Bruce L-C [MVP] wrote:
>> I think you are confusing design versus runtime. I only briefly played
>> with local mode. I use the control in server mode. I decided that local
>> mode was a total pain.
>>
>> I do know that at run time you give the control the report file name and
>> the data table (not dataset). So in code you generate the datatable.
>>
>> What I found easiest and this works because you are using RS 2005 is to
>> create the report in RS 2005. Rename the rdl file to rdlc. Bring that
>> report into your project. Much easier to design the report outside of VS
>> 2005.
>>

From: Emma on
RAQ Report can generate a dataset for local report easily. About more steps,
You can refer to
http://andyandydfjid.spaces.live.com/blog/cns!4DD65F2C375B8ECE!459.entry.