Wednesday, March 7, 2012

Local report from local dataset

Hi,
I have some experience with RS 2000, but just started 2005.
I am trying to incorporate reports into my application using report viewer,
no server.
I will report from the data set that I created inside of my app. It is also
possible that based on user's input some fields can be suppressed.
I know that I can use business objects, but it looks like I have everything
in my data set. So, can I build my report(s) from this data set in design
time (how can I see my data set as data source?)?
And another question, is there any API to manipulate controls on report
during design time? I spent a lot of time with Crystal - I can do this there.
I hope RS has something like this or even better.
Thanks.Something like the code below. What APIs do you need at design time?
' Load the dataset
adapter.Fill(dataset)
' Local report
reportViewer.ProcessingMode = ProcessingMode.Local
reportViewer.LocalReport.EnableHyperlinks = True
' Set RDL file
reportViewer.LocalReport.ReportPath = "Sales Forecast.rdlc"
' Supply a DataTable for the report data source
reportViewer.LocalReport.DataSources.Add(New
ReportDataSource("SalesForecast_Table", dataset.Tables(0)))
' Set the report parameters. Notice that the parameters array is 0-based,
hence (1) for two parameters
Dim parameters(1) As ReportParameter
parameters(0) = New ReportParameter("Year", 2003)
parameters(1) = New ReportParameter("NumberMonths", 3)
reportViewer.LocalReport.SetParameters(parameters)
reportViewer.RefreshReport()
HTH,
---
Teo Lachev, MVP, MCSD, MCT
"Microsoft Reporting Services in Action"
"Applied Microsoft Analysis Services 2005"
Home page and blog: http://www.prologika.com/
---
"Victor" <Victor@.discussions.microsoft.com> wrote in message
news:BA5E4C4F-A866-4929-9E30-07552EDF687E@.microsoft.com...
> Hi,
> I have some experience with RS 2000, but just started 2005.
> I am trying to incorporate reports into my application using report
> viewer,
> no server.
> I will report from the data set that I created inside of my app. It is
> also
> possible that based on user's input some fields can be suppressed.
> I know that I can use business objects, but it looks like I have
> everything
> in my data set. So, can I build my report(s) from this data set in design
> time (how can I see my data set as data source?)?
> And another question, is there any API to manipulate controls on report
> during design time? I spent a lot of time with Crystal - I can do this
> there.
> I hope RS has something like this or even better.
> Thanks.|||Thank you Teo,
API to hide/show/change/etc. fields or any items. Probably it can be done by
manipulating XML file .rdlc, but is there any API for this already?
Also, can I build my own dataset and then based on it build my report,
during design time and during run time?
And Teo, are you going to write another book on SSRS, but now based on 2005?
Thanks.
"Teo Lachev [MVP]" wrote:
> Something like the code below. What APIs do you need at design time?
> ' Load the dataset
> adapter.Fill(dataset)
> ' Local report
> reportViewer.ProcessingMode = ProcessingMode.Local
> reportViewer.LocalReport.EnableHyperlinks = True
> ' Set RDL file
> reportViewer.LocalReport.ReportPath = "Sales Forecast.rdlc"
> ' Supply a DataTable for the report data source
> reportViewer.LocalReport.DataSources.Add(New
> ReportDataSource("SalesForecast_Table", dataset.Tables(0)))
> ' Set the report parameters. Notice that the parameters array is 0-based,
> hence (1) for two parameters
> Dim parameters(1) As ReportParameter
> parameters(0) = New ReportParameter("Year", 2003)
> parameters(1) = New ReportParameter("NumberMonths", 3)
> reportViewer.LocalReport.SetParameters(parameters)
> reportViewer.RefreshReport()
>
> --
> HTH,
> ---
> Teo Lachev, MVP, MCSD, MCT
> "Microsoft Reporting Services in Action"
> "Applied Microsoft Analysis Services 2005"
> Home page and blog: http://www.prologika.com/
> ---
> "Victor" <Victor@.discussions.microsoft.com> wrote in message
> news:BA5E4C4F-A866-4929-9E30-07552EDF687E@.microsoft.com...
> > Hi,
> > I have some experience with RS 2000, but just started 2005.
> > I am trying to incorporate reports into my application using report
> > viewer,
> > no server.
> > I will report from the data set that I created inside of my app. It is
> > also
> > possible that based on user's input some fields can be suppressed.
> >
> > I know that I can use business objects, but it looks like I have
> > everything
> > in my data set. So, can I build my report(s) from this data set in design
> > time (how can I see my data set as data source?)?
> >
> > And another question, is there any API to manipulate controls on report
> > during design time? I spent a lot of time with Crystal - I can do this
> > there.
> > I hope RS has something like this or even better.
> >
> > Thanks.
>
>|||The APIs are XML DOM. since RDL is XML-based. If you have too much
manipulation to do, consider buiding an object model on top of it. That's
what I am doing for my currect project. Yes, you can use VS.NET 2005 to
design your report.
About the book...I decided to skip 2005. The new one is about SSAS 2005 and
BI (http://www.prologika.com/Books/0976635305/Book.aspx)
--
HTH,
---
Teo Lachev, MVP, MCSD, MCT
"Microsoft Reporting Services in Action"
"Applied Microsoft Analysis Services 2005"
Home page and blog: http://www.prologika.com/
---
"Victor" <Victor@.discussions.microsoft.com> wrote in message
news:A89E4115-09EF-4AC0-998E-9C6C9AEDAB07@.microsoft.com...
> Thank you Teo,
> API to hide/show/change/etc. fields or any items. Probably it can be done
> by
> manipulating XML file .rdlc, but is there any API for this already?
> Also, can I build my own dataset and then based on it build my report,
> during design time and during run time?
> And Teo, are you going to write another book on SSRS, but now based on
> 2005?
> Thanks.
>
> "Teo Lachev [MVP]" wrote:
>> Something like the code below. What APIs do you need at design time?
>> ' Load the dataset
>> adapter.Fill(dataset)
>> ' Local report
>> reportViewer.ProcessingMode = ProcessingMode.Local
>> reportViewer.LocalReport.EnableHyperlinks = True
>> ' Set RDL file
>> reportViewer.LocalReport.ReportPath = "Sales Forecast.rdlc"
>> ' Supply a DataTable for the report data source
>> reportViewer.LocalReport.DataSources.Add(New
>> ReportDataSource("SalesForecast_Table", dataset.Tables(0)))
>> ' Set the report parameters. Notice that the parameters array is 0-based,
>> hence (1) for two parameters
>> Dim parameters(1) As ReportParameter
>> parameters(0) = New ReportParameter("Year", 2003)
>> parameters(1) = New ReportParameter("NumberMonths", 3)
>> reportViewer.LocalReport.SetParameters(parameters)
>> reportViewer.RefreshReport()
>>
>> --
>> HTH,
>> ---
>> Teo Lachev, MVP, MCSD, MCT
>> "Microsoft Reporting Services in Action"
>> "Applied Microsoft Analysis Services 2005"
>> Home page and blog: http://www.prologika.com/
>> ---
>> "Victor" <Victor@.discussions.microsoft.com> wrote in message
>> news:BA5E4C4F-A866-4929-9E30-07552EDF687E@.microsoft.com...
>> > Hi,
>> > I have some experience with RS 2000, but just started 2005.
>> > I am trying to incorporate reports into my application using report
>> > viewer,
>> > no server.
>> > I will report from the data set that I created inside of my app. It is
>> > also
>> > possible that based on user's input some fields can be suppressed.
>> >
>> > I know that I can use business objects, but it looks like I have
>> > everything
>> > in my data set. So, can I build my report(s) from this data set in
>> > design
>> > time (how can I see my data set as data source?)?
>> >
>> > And another question, is there any API to manipulate controls on report
>> > during design time? I spent a lot of time with Crystal - I can do this
>> > there.
>> > I hope RS has something like this or even better.
>> >
>> > Thanks.
>>|||I am new to .Net and would appreciate little bit more clarification on
Victor's question as to 'How can I build my report(s) from this data
set in design
time (how can I see my data set as data source?)?. I am actually
planning to use DataReader and than load a DataTable with the reader
and use that as my Report Datasource. Any suggestion on the approach is
welcome.
Thanks,
Srivast
Teo Lachev [MVP] wrote:
> The APIs are XML DOM. since RDL is XML-based. If you have too much
> manipulation to do, consider buiding an object model on top of it. That's
> what I am doing for my currect project. Yes, you can use VS.NET 2005 to
> design your report.
> About the book...I decided to skip 2005. The new one is about SSAS 2005 and
> BI (http://www.prologika.com/Books/0976635305/Book.aspx)
> --
> HTH,
> ---
> Teo Lachev, MVP, MCSD, MCT
> "Microsoft Reporting Services in Action"
> "Applied Microsoft Analysis Services 2005"
> Home page and blog: http://www.prologika.com/
> ---
> "Victor" <Victor@.discussions.microsoft.com> wrote in message
> news:A89E4115-09EF-4AC0-998E-9C6C9AEDAB07@.microsoft.com...
> > Thank you Teo,
> >
> > API to hide/show/change/etc. fields or any items. Probably it can be done
> > by
> > manipulating XML file .rdlc, but is there any API for this already?
> >
> > Also, can I build my own dataset and then based on it build my report,
> > during design time and during run time?
> >
> > And Teo, are you going to write another book on SSRS, but now based on
> > 2005?
> >
> > Thanks.
> >
> >
> > "Teo Lachev [MVP]" wrote:
> >
> >> Something like the code below. What APIs do you need at design time?
> >>
> >> ' Load the dataset
> >>
> >> adapter.Fill(dataset)
> >>
> >> ' Local report
> >>
> >> reportViewer.ProcessingMode = ProcessingMode.Local
> >>
> >> reportViewer.LocalReport.EnableHyperlinks = True
> >>
> >> ' Set RDL file
> >>
> >> reportViewer.LocalReport.ReportPath = "Sales Forecast.rdlc"
> >>
> >> ' Supply a DataTable for the report data source
> >>
> >> reportViewer.LocalReport.DataSources.Add(New
> >> ReportDataSource("SalesForecast_Table", dataset.Tables(0)))
> >>
> >> ' Set the report parameters. Notice that the parameters array is 0-based,
> >> hence (1) for two parameters
> >>
> >> Dim parameters(1) As ReportParameter
> >>
> >> parameters(0) = New ReportParameter("Year", 2003)
> >>
> >> parameters(1) = New ReportParameter("NumberMonths", 3)
> >>
> >> reportViewer.LocalReport.SetParameters(parameters)
> >>
> >> reportViewer.RefreshReport()
> >>
> >>
> >> --
> >> HTH,
> >> ---
> >> Teo Lachev, MVP, MCSD, MCT
> >> "Microsoft Reporting Services in Action"
> >> "Applied Microsoft Analysis Services 2005"
> >> Home page and blog: http://www.prologika.com/
> >>
> >> ---
> >> "Victor" <Victor@.discussions.microsoft.com> wrote in message
> >> news:BA5E4C4F-A866-4929-9E30-07552EDF687E@.microsoft.com...
> >> > Hi,
> >> > I have some experience with RS 2000, but just started 2005.
> >> > I am trying to incorporate reports into my application using report
> >> > viewer,
> >> > no server.
> >> > I will report from the data set that I created inside of my app. It is
> >> > also
> >> > possible that based on user's input some fields can be suppressed.
> >> >
> >> > I know that I can use business objects, but it looks like I have
> >> > everything
> >> > in my data set. So, can I build my report(s) from this data set in
> >> > design
> >> > time (how can I see my data set as data source?)?
> >> >
> >> > And another question, is there any API to manipulate controls on report
> >> > during design time? I spent a lot of time with Crystal - I can do this
> >> > there.
> >> > I hope RS has something like this or even better.
> >> >
> >> > Thanks.
> >>
> >>
> >>|||I have done this and the code that Teo posted will work for you. What I have
found easiest is to design a report using the Reporting Services designer
(you can design without a server). The UI is much easier. Get the report to
work. Then copy over the rdl file renaming it to rdlc. Then use the control
setting it to the rdlc file and giving it your datatable. Note that in local
mode you have to handle subreports and other actions that are done for you
automatically in server mode. So, although you can do this, if you are using
the server product I would evaluate whether you really should do it.
Bruce Loehle-Conger
MVP SQL Server Reporting Services
"Srivast" <sarita.srivastava@.avon.com> wrote in message
news:1133884592.106808.80610@.g43g2000cwa.googlegroups.com...
>I am new to .Net and would appreciate little bit more clarification on
> Victor's question as to 'How can I build my report(s) from this data
> set in design
> time (how can I see my data set as data source?)?. I am actually
> planning to use DataReader and than load a DataTable with the reader
> and use that as my Report Datasource. Any suggestion on the approach is
> welcome.
> Thanks,
> Srivast
>
> Teo Lachev [MVP] wrote:
>> The APIs are XML DOM. since RDL is XML-based. If you have too much
>> manipulation to do, consider buiding an object model on top of it. That's
>> what I am doing for my currect project. Yes, you can use VS.NET 2005 to
>> design your report.
>> About the book...I decided to skip 2005. The new one is about SSAS 2005
>> and
>> BI (http://www.prologika.com/Books/0976635305/Book.aspx)
>> --
>> HTH,
>> ---
>> Teo Lachev, MVP, MCSD, MCT
>> "Microsoft Reporting Services in Action"
>> "Applied Microsoft Analysis Services 2005"
>> Home page and blog: http://www.prologika.com/
>> ---
>> "Victor" <Victor@.discussions.microsoft.com> wrote in message
>> news:A89E4115-09EF-4AC0-998E-9C6C9AEDAB07@.microsoft.com...
>> > Thank you Teo,
>> >
>> > API to hide/show/change/etc. fields or any items. Probably it can be
>> > done
>> > by
>> > manipulating XML file .rdlc, but is there any API for this already?
>> >
>> > Also, can I build my own dataset and then based on it build my report,
>> > during design time and during run time?
>> >
>> > And Teo, are you going to write another book on SSRS, but now based on
>> > 2005?
>> >
>> > Thanks.
>> >
>> >
>> > "Teo Lachev [MVP]" wrote:
>> >
>> >> Something like the code below. What APIs do you need at design time?
>> >>
>> >> ' Load the dataset
>> >>
>> >> adapter.Fill(dataset)
>> >>
>> >> ' Local report
>> >>
>> >> reportViewer.ProcessingMode = ProcessingMode.Local
>> >>
>> >> reportViewer.LocalReport.EnableHyperlinks = True
>> >>
>> >> ' Set RDL file
>> >>
>> >> reportViewer.LocalReport.ReportPath = "Sales Forecast.rdlc"
>> >>
>> >> ' Supply a DataTable for the report data source
>> >>
>> >> reportViewer.LocalReport.DataSources.Add(New
>> >> ReportDataSource("SalesForecast_Table", dataset.Tables(0)))
>> >>
>> >> ' Set the report parameters. Notice that the parameters array is
>> >> 0-based,
>> >> hence (1) for two parameters
>> >>
>> >> Dim parameters(1) As ReportParameter
>> >>
>> >> parameters(0) = New ReportParameter("Year", 2003)
>> >>
>> >> parameters(1) = New ReportParameter("NumberMonths", 3)
>> >>
>> >> reportViewer.LocalReport.SetParameters(parameters)
>> >>
>> >> reportViewer.RefreshReport()
>> >>
>> >>
>> >> --
>> >> HTH,
>> >> ---
>> >> Teo Lachev, MVP, MCSD, MCT
>> >> "Microsoft Reporting Services in Action"
>> >> "Applied Microsoft Analysis Services 2005"
>> >> Home page and blog: http://www.prologika.com/
>> >>
>> >> ---
>> >> "Victor" <Victor@.discussions.microsoft.com> wrote in message
>> >> news:BA5E4C4F-A866-4929-9E30-07552EDF687E@.microsoft.com...
>> >> > Hi,
>> >> > I have some experience with RS 2000, but just started 2005.
>> >> > I am trying to incorporate reports into my application using report
>> >> > viewer,
>> >> > no server.
>> >> > I will report from the data set that I created inside of my app. It
>> >> > is
>> >> > also
>> >> > possible that based on user's input some fields can be suppressed.
>> >> >
>> >> > I know that I can use business objects, but it looks like I have
>> >> > everything
>> >> > in my data set. So, can I build my report(s) from this data set in
>> >> > design
>> >> > time (how can I see my data set as data source?)?
>> >> >
>> >> > And another question, is there any API to manipulate controls on
>> >> > report
>> >> > during design time? I spent a lot of time with Crystal - I can do
>> >> > this
>> >> > there.
>> >> > I hope RS has something like this or even better.
>> >> >
>> >> > Thanks.
>> >>
>> >>
>> >>
>|||Precisely. Accidentally, I am working on a two-part article for DevX that
will cover the report viewers in more details. I will post an announcement
when it is published.
--
HTH,
---
Teo Lachev, MVP, MCSD, MCT
"Microsoft Reporting Services in Action"
"Applied Microsoft Analysis Services 2005"
Home page and blog: http://www.prologika.com/
---
"Bruce L-C [MVP]" <bruce_lcNOSPAM@.hotmail.com> wrote in message
news:OVnkcBo%23FHA.1600@.TK2MSFTNGP11.phx.gbl...
>I have done this and the code that Teo posted will work for you. What I
>have found easiest is to design a report using the Reporting Services
>designer (you can design without a server). The UI is much easier. Get the
>report to work. Then copy over the rdl file renaming it to rdlc. Then use
>the control setting it to the rdlc file and giving it your datatable. Note
>that in local mode you have to handle subreports and other actions that are
>done for you automatically in server mode. So, although you can do this, if
>you are using the server product I would evaluate whether you really should
>do it.
>
> --
> Bruce Loehle-Conger
> MVP SQL Server Reporting Services
> "Srivast" <sarita.srivastava@.avon.com> wrote in message
> news:1133884592.106808.80610@.g43g2000cwa.googlegroups.com...
>>I am new to .Net and would appreciate little bit more clarification on
>> Victor's question as to 'How can I build my report(s) from this data
>> set in design
>> time (how can I see my data set as data source?)?. I am actually
>> planning to use DataReader and than load a DataTable with the reader
>> and use that as my Report Datasource. Any suggestion on the approach is
>> welcome.
>> Thanks,
>> Srivast
>>
>> Teo Lachev [MVP] wrote:
>> The APIs are XML DOM. since RDL is XML-based. If you have too much
>> manipulation to do, consider buiding an object model on top of it.
>> That's
>> what I am doing for my currect project. Yes, you can use VS.NET 2005 to
>> design your report.
>> About the book...I decided to skip 2005. The new one is about SSAS 2005
>> and
>> BI (http://www.prologika.com/Books/0976635305/Book.aspx)
>> --
>> HTH,
>> ---
>> Teo Lachev, MVP, MCSD, MCT
>> "Microsoft Reporting Services in Action"
>> "Applied Microsoft Analysis Services 2005"
>> Home page and blog: http://www.prologika.com/
>> ---
>> "Victor" <Victor@.discussions.microsoft.com> wrote in message
>> news:A89E4115-09EF-4AC0-998E-9C6C9AEDAB07@.microsoft.com...
>> > Thank you Teo,
>> >
>> > API to hide/show/change/etc. fields or any items. Probably it can be
>> > done
>> > by
>> > manipulating XML file .rdlc, but is there any API for this already?
>> >
>> > Also, can I build my own dataset and then based on it build my report,
>> > during design time and during run time?
>> >
>> > And Teo, are you going to write another book on SSRS, but now based on
>> > 2005?
>> >
>> > Thanks.
>> >
>> >
>> > "Teo Lachev [MVP]" wrote:
>> >
>> >> Something like the code below. What APIs do you need at design time?
>> >>
>> >> ' Load the dataset
>> >>
>> >> adapter.Fill(dataset)
>> >>
>> >> ' Local report
>> >>
>> >> reportViewer.ProcessingMode = ProcessingMode.Local
>> >>
>> >> reportViewer.LocalReport.EnableHyperlinks = True
>> >>
>> >> ' Set RDL file
>> >>
>> >> reportViewer.LocalReport.ReportPath = "Sales Forecast.rdlc"
>> >>
>> >> ' Supply a DataTable for the report data source
>> >>
>> >> reportViewer.LocalReport.DataSources.Add(New
>> >> ReportDataSource("SalesForecast_Table", dataset.Tables(0)))
>> >>
>> >> ' Set the report parameters. Notice that the parameters array is
>> >> 0-based,
>> >> hence (1) for two parameters
>> >>
>> >> Dim parameters(1) As ReportParameter
>> >>
>> >> parameters(0) = New ReportParameter("Year", 2003)
>> >>
>> >> parameters(1) = New ReportParameter("NumberMonths", 3)
>> >>
>> >> reportViewer.LocalReport.SetParameters(parameters)
>> >>
>> >> reportViewer.RefreshReport()
>> >>
>> >>
>> >> --
>> >> HTH,
>> >> ---
>> >> Teo Lachev, MVP, MCSD, MCT
>> >> "Microsoft Reporting Services in Action"
>> >> "Applied Microsoft Analysis Services 2005"
>> >> Home page and blog: http://www.prologika.com/
>> >>
>> >> ---
>> >> "Victor" <Victor@.discussions.microsoft.com> wrote in message
>> >> news:BA5E4C4F-A866-4929-9E30-07552EDF687E@.microsoft.com...
>> >> > Hi,
>> >> > I have some experience with RS 2000, but just started 2005.
>> >> > I am trying to incorporate reports into my application using report
>> >> > viewer,
>> >> > no server.
>> >> > I will report from the data set that I created inside of my app. It
>> >> > is
>> >> > also
>> >> > possible that based on user's input some fields can be suppressed.
>> >> >
>> >> > I know that I can use business objects, but it looks like I have
>> >> > everything
>> >> > in my data set. So, can I build my report(s) from this data set in
>> >> > design
>> >> > time (how can I see my data set as data source?)?
>> >> >
>> >> > And another question, is there any API to manipulate controls on
>> >> > report
>> >> > during design time? I spent a lot of time with Crystal - I can do
>> >> > this
>> >> > there.
>> >> > I hope RS has something like this or even better.
>> >> >
>> >> > Thanks.
>> >>
>> >>
>> >>
>|||I have used the code above to write a report browser. The first report
shows fine, only if I select a different repport the first report keeps
coming back. No errors no messages. This is the code I use. Does
anybody knows the solution?
Thank you,
Arjan
private void button1_Click(object sender, EventArgs e)
{
this.openFileDialog1.InitialDirectory =System.Reflection.Assembly.GetExecutingAssembly().Location;
DialogResult _result = this.openFileDialog1.ShowDialog();
if (_result == DialogResult.OK)
{
string _fileName =this.openFileDialog1.FileName.ToString();
if (Path.GetExtension(_fileName) == ".rdlc")
{
this.reportViewer1.ProcessingMode =ProcessingMode.Local;
FileStream _stream = File.OpenRead(_fileName);
this.reportViewer1.LocalReport.LoadReportDefinition(_stream);
_stream.Close();
foreach (string _dataSetName in
this.reportViewer1.LocalReport.GetDataSourceNames())
{
DataTable _dt = new DataTable();
SqlCommand _command = new SqlCommand("SELECT *
FROM " + _dataSetName.Replace("ProjectDataSet_", ""), new
SqlConnection("ConnectionString"));
_command.CommandType = CommandType.Text;
new SqlDataAdapter(_command).Fill(_dt);
ReportDataSource _reportDataSource = new
ReportDataSource();
_reportDataSource.Name = _dataSetName;
_reportDataSource.Value = _dt;
this.reportViewer1.LocalReport.DataSources.Add(_reportDataSource);
}
this.reportViewer1.RefreshReport();
}
else
{
MessageBox.Show("Invalid extension");
}
}
}|||Try reportViewer1.Reset() before rendering. Also, I noticed that you are
calling LoadReportDefinition. This method will render the report ad-hoc. I
think what you need here is just setting the ReportPath to your rdlc file,
e.g.
reportViewer1.LocalReport.ReportPath = "<myreportname>.rdlc"
--
HTH,
---
Teo Lachev, MVP, MCSD, MCT
"Microsoft Reporting Services in Action"
"Applied Microsoft Analysis Services 2005"
Home page and blog: http://www.prologika.com/
---
<arjan@.synion.nl> wrote in message
news:1134056833.592280.285570@.g14g2000cwa.googlegroups.com...
>I have used the code above to write a report browser. The first report
> shows fine, only if I select a different repport the first report keeps
> coming back. No errors no messages. This is the code I use. Does
> anybody knows the solution?
> Thank you,
> Arjan
> private void button1_Click(object sender, EventArgs e)
> {
> this.openFileDialog1.InitialDirectory => System.Reflection.Assembly.GetExecutingAssembly().Location;
> DialogResult _result = this.openFileDialog1.ShowDialog();
> if (_result == DialogResult.OK)
> {
> string _fileName => this.openFileDialog1.FileName.ToString();
> if (Path.GetExtension(_fileName) == ".rdlc")
> {
> this.reportViewer1.ProcessingMode => ProcessingMode.Local;
> FileStream _stream = File.OpenRead(_fileName);
> this.reportViewer1.LocalReport.LoadReportDefinition(_stream);
> _stream.Close();
> foreach (string _dataSetName in
> this.reportViewer1.LocalReport.GetDataSourceNames())
> {
> DataTable _dt = new DataTable();
> SqlCommand _command = new SqlCommand("SELECT *
> FROM " + _dataSetName.Replace("ProjectDataSet_", ""), new
> SqlConnection("ConnectionString"));
> _command.CommandType = CommandType.Text;
> new SqlDataAdapter(_command).Fill(_dt);
> ReportDataSource _reportDataSource = new
> ReportDataSource();
> _reportDataSource.Name = _dataSetName;
> _reportDataSource.Value = _dt;
>
> this.reportViewer1.LocalReport.DataSources.Add(_reportDataSource);
> }
> this.reportViewer1.RefreshReport();
> }
> else
> {
> MessageBox.Show("Invalid extension");
> }
> }
> }
>|||Yes that did the trick! Thank you!
I want to alter a 'template' rdlc with new values and stream the result
to the reportviewer control. That is why I used the stream.
Does anyone know an opensource project 'rdl(c) file to class'? Input is
the path to an rdl(c) file, output is a class with all the settings in
the file. Simply alter class and stream class.ToSring() to the viewer.
Thank you,
Arjan|||I have noticed that the webform reportviewer does not have the Reset
method. What to do on a webform when changing reports in local mode?
Thank you,
Arjan|||We developed our own object wrapper on top of RDL. It is not that hard to do
given that the RDL spec is out there
(http://download.microsoft.com/download/c/2/0/c2091a26-d7bf-4464-8535-dbc31fb45d3c/rdlNov05.pdf)
and it really pays out in a long run. http://www.fyireporting.com/ could be
a good start.
--
HTH,
---
Teo Lachev, MVP, MCSD, MCT
"Microsoft Reporting Services in Action"
"Applied Microsoft Analysis Services 2005"
Home page and blog: http://www.prologika.com/
---
"Arjan" <arjan@.synion.nl> wrote in message
news:1134310904.001437.37200@.g47g2000cwa.googlegroups.com...
> Yes that did the trick! Thank you!
> I want to alter a 'template' rdlc with new values and stream the result
> to the reportviewer control. That is why I used the stream.
> Does anyone know an opensource project 'rdl(c) file to class'? Input is
> the path to an rdl(c) file, output is a class with all the settings in
> the file. Simply alter class and stream class.ToSring() to the viewer.
> Thank you,
> Arjan
>

No comments:

Post a Comment