Showing posts with label report. Show all posts
Showing posts with label report. Show all posts

Wednesday, March 28, 2012

Problem report xp_MSADEnabled

Hello,
I have detected a problem with the stored procedure xp_MSADEnabled. I am using Windows 2000 (workstation, 5.00.2195, SP4) and SQLServer 2000 Developer (Product version 8.00.858 SP3). Calling xp_MSADEnabled results in an unspecified error (-2147467259).
If I call the same procedure on a Windows 2003 Server machine, it works fine.
This procedure is called in several other system procedures like sp_addmergepublication and sp_dropmergepublication.
I am developing the replication functionality of a database application. I discovered the problem when I wanted to call sp_addmergepublication from my ADO.NET application. This resulted in the SqlException "A severe error occurred on the current command.
The results, if any, should be discarded". Calling this procedure from the SQL Query Analyzer did not result in the error.
greeting, Marco
Hi
Looking at other people having problems with this xp_MSADEnabled tend to
point to service account problems such as duplicate account entries in the
AD or insufficient permissions to access it.
John
"Marco Broenink" <marco.broenink@.ict.nl> wrote in message
news:0EB1A879-F364-4646-AE5B-28C3754194AD@.microsoft.com...
> Hello,
> I have detected a problem with the stored procedure xp_MSADEnabled. I am
using Windows 2000 (workstation, 5.00.2195, SP4) and SQLServer 2000
Developer (Product version 8.00.858 SP3). Calling xp_MSADEnabled results in
an unspecified error (-2147467259).
> If I call the same procedure on a Windows 2003 Server machine, it works
fine.
> This procedure is called in several other system procedures like
sp_addmergepublication and sp_dropmergepublication.
> I am developing the replication functionality of a database application. I
discovered the problem when I wanted to call sp_addmergepublication from my
ADO.NET application. This resulted in the SqlException "A severe error
occurred on the current command. The results, if any, should be discarded".
Calling this procedure from the SQL Query Analyzer did not result in the
error.
> greeting, Marco

Problem report xp_MSADEnabled

Hello
I have detected a problem with the stored procedure xp_MSADEnabled. I am using Windows 2000 (workstation, 5.00.2195, SP4) and SQLServer 2000 Developer (Product version 8.00.858 SP3). Calling xp_MSADEnabled results in an unspecified error (-2147467259)
If I call the same procedure on a Windows 2003 Server machine, it works fine
This procedure is called in several other system procedures like sp_addmergepublication and sp_dropmergepublication.
I am developing the replication functionality of a database application. I discovered the problem when I wanted to call sp_addmergepublication from my ADO.NET application. This resulted in the SqlException "A severe error occurred on the current command. The results, if any, should be discarded". Calling this procedure from the SQL Query Analyzer did not result in the error
greeting, MarcoHi
Looking at other people having problems with this xp_MSADEnabled tend to
point to service account problems such as duplicate account entries in the
AD or insufficient permissions to access it.
John
"Marco Broenink" <marco.broenink@.ict.nl> wrote in message
news:0EB1A879-F364-4646-AE5B-28C3754194AD@.microsoft.com...
> Hello,
> I have detected a problem with the stored procedure xp_MSADEnabled. I am
using Windows 2000 (workstation, 5.00.2195, SP4) and SQLServer 2000
Developer (Product version 8.00.858 SP3). Calling xp_MSADEnabled results in
an unspecified error (-2147467259).
> If I call the same procedure on a Windows 2003 Server machine, it works
fine.
> This procedure is called in several other system procedures like
sp_addmergepublication and sp_dropmergepublication.
> I am developing the replication functionality of a database application. I
discovered the problem when I wanted to call sp_addmergepublication from my
ADO.NET application. This resulted in the SqlException "A severe error
occurred on the current command. The results, if any, should be discarded".
Calling this procedure from the SQL Query Analyzer did not result in the
error.
> greeting, Marcosql

Problem report xp_MSADEnabled

Hello,
I have detected a problem with the stored procedure xp_MSADEnabled. I am using Windows 2000 (workstation, 5.00.2195, SP4) and SQLServer 2000 Developer (Product version 8.00.858 SP3). Calling xp_MSADEnabled results in an unspecified error (-2147467259).
If I call the same procedure on a Windows 2003 Server machine, it works fine.
This procedure is called in several other system procedures like sp_addmergepublication and sp_dropmergepublication.
I am developing the replication functionality of a database application. I discovered the problem when I wanted to call sp_addmergepublication from my ADO.NET application. This resulted in the SqlException "A severe error occurred on the current command.
The results, if any, should be discarded". Calling this procedure from the SQL Query Analyzer did not result in the error.
greeting, Marco
This procedure test to see if the particular SQL Server is Active Directory enabled.
In your code are you publishing your publication to Active Directory? IE in the proc sp_addpublication are you setting
@.add_to_active_directory to true?
Do you need this functionality?
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html
|||Thanks for reply.
I don't need active directory functionality. I set the @.add_to_active_directory to false but the sp_addmergepublication still calls xp_MSADEnabled.
-- Hilary Cotter wrote: --
This procedure test to see if the particular SQL Server is Active Directory enabled.
In your code are you publishing your publication to Active Directory? IE in the proc sp_addpublication are you setting
@.add_to_active_directory to true?
Do you need this functionality?
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html
|||Hi
Looking at other people having problems with this xp_MSADEnabled tend to
point to service account problems such as duplicate account entries in the
AD or insufficient permissions to access it.
John
"Marco Broenink" <marco.broenink@.ict.nl> wrote in message
news:0EB1A879-F364-4646-AE5B-28C3754194AD@.microsoft.com...
> Hello,
> I have detected a problem with the stored procedure xp_MSADEnabled. I am
using Windows 2000 (workstation, 5.00.2195, SP4) and SQLServer 2000
Developer (Product version 8.00.858 SP3). Calling xp_MSADEnabled results in
an unspecified error (-2147467259).
> If I call the same procedure on a Windows 2003 Server machine, it works
fine.
> This procedure is called in several other system procedures like
sp_addmergepublication and sp_dropmergepublication.
> I am developing the replication functionality of a database application. I
discovered the problem when I wanted to call sp_addmergepublication from my
ADO.NET application. This resulted in the SqlException "A severe error
occurred on the current command. The results, if any, should be discarded".
Calling this procedure from the SQL Query Analyzer did not result in the
error.
> greeting, Marco

Problem Report Viewer Control

I am having an authentication problem using the Report Viewer Control. The
situation is that I have developed a simple ASP.NET application that will
used as an interface for Report Viewing. First, I have a TreeView Control
located on the default page that is being populated with the current reports
that are published on the Report Server. Second, I have a aspx page called
ReportViewer that holds the Report Viewer Control. Third, when a user clicks
on one of the reports in the TreeView control the report is generated in an
IFrame located in a table cell on the default page.
My Problem is that everytime I click to generate a report I am asked for
windows credentials. I am passing the full network credentials(testing
environment going to use an application pool when live and pass default
credentials) example System.Net.NetworkCredential("username", "password",
"domain") in the load event of both aspx pages and IIS directory security is
setup with anonymous access & integrated windows authentication(I have tried
about everything in IIS Directory Security). I have tried about everything
and for the life of me cannot get around this issue any assistance would be
greatly appreciated.
Thanks,
--
Andrew
MCSA,MCDBAIf your asp app is on a different machine then I think you are hitting the
double hop issue. You need to be using Kerberos to support double hop. This
is an IIS issue. Here is a good link:
http://support.microsoft.com/default.aspx?scid=kb;en-us;264921
I notice that you have enable anonymous on IIS where RS is located. This is
a bad idea. It will cause difficulties with managing Report Server. Either
you need to setup your security using Kerberos or you will have to implement
forms based authentication. If there is another way around it I am not sure
what it would be.
Bruce Loehle-Conger
MVP SQL Server Reporting Services
"Andrew" <Andrew@.discussions.microsoft.com> wrote in message
news:60F64653-3B04-4E3C-9ADA-D06A191AB9EE@.microsoft.com...
>I am having an authentication problem using the Report Viewer Control. The
> situation is that I have developed a simple ASP.NET application that will
> used as an interface for Report Viewing. First, I have a TreeView Control
> located on the default page that is being populated with the current
> reports
> that are published on the Report Server. Second, I have a aspx page called
> ReportViewer that holds the Report Viewer Control. Third, when a user
> clicks
> on one of the reports in the TreeView control the report is generated in
> an
> IFrame located in a table cell on the default page.
> My Problem is that everytime I click to generate a report I am asked for
> windows credentials. I am passing the full network credentials(testing
> environment going to use an application pool when live and pass default
> credentials) example System.Net.NetworkCredential("username", "password",
> "domain") in the load event of both aspx pages and IIS directory security
> is
> setup with anonymous access & integrated windows authentication(I have
> tried
> about everything in IIS Directory Security). I have tried about everything
> and for the life of me cannot get around this issue any assistance would
> be
> greatly appreciated.
> Thanks,
> --
> Andrew
> MCSA,MCDBA|||Bruce,
Thanks for the response and I am just using windows authentication on the
live report server. I enabled the anonymous access in a testing environment
just to try to get around the authentication problems I was encountering. My
issue was that I am developing in a different domain and I am accessing the
report server by IP address. Well when I implemented the application on the
production domain I never changed the report server path to the actual report
server machine name and this caused my authentication problem. Just one of
those little slip ups that seem to cause the biggest problems. Thanks,
--
Andrew
MCSA,MCDBA
--
Andrew
MCSA,MCDBA
"Bruce L-C [MVP]" wrote:
> If your asp app is on a different machine then I think you are hitting the
> double hop issue. You need to be using Kerberos to support double hop. This
> is an IIS issue. Here is a good link:
> http://support.microsoft.com/default.aspx?scid=kb;en-us;264921
> I notice that you have enable anonymous on IIS where RS is located. This is
> a bad idea. It will cause difficulties with managing Report Server. Either
> you need to setup your security using Kerberos or you will have to implement
> forms based authentication. If there is another way around it I am not sure
> what it would be.
>
> --
> Bruce Loehle-Conger
> MVP SQL Server Reporting Services
>
> "Andrew" <Andrew@.discussions.microsoft.com> wrote in message
> news:60F64653-3B04-4E3C-9ADA-D06A191AB9EE@.microsoft.com...
> >I am having an authentication problem using the Report Viewer Control. The
> > situation is that I have developed a simple ASP.NET application that will
> > used as an interface for Report Viewing. First, I have a TreeView Control
> > located on the default page that is being populated with the current
> > reports
> > that are published on the Report Server. Second, I have a aspx page called
> > ReportViewer that holds the Report Viewer Control. Third, when a user
> > clicks
> > on one of the reports in the TreeView control the report is generated in
> > an
> > IFrame located in a table cell on the default page.
> >
> > My Problem is that everytime I click to generate a report I am asked for
> > windows credentials. I am passing the full network credentials(testing
> > environment going to use an application pool when live and pass default
> > credentials) example System.Net.NetworkCredential("username", "password",
> > "domain") in the load event of both aspx pages and IIS directory security
> > is
> > setup with anonymous access & integrated windows authentication(I have
> > tried
> > about everything in IIS Directory Security). I have tried about everything
> > and for the life of me cannot get around this issue any assistance would
> > be
> > greatly appreciated.
> >
> > Thanks,
> >
> > --
> > Andrew
> > MCSA,MCDBA
>
>|||Ahh, same symptom as double hop but different reason. Glad you got it figure
out.
Bruce Loehle-Conger
MVP SQL Server Reporting Services
"Andrew" <Andrew@.discussions.microsoft.com> wrote in message
news:28AC4137-F5A4-4F09-8B00-80126775DBB6@.microsoft.com...
> Bruce,
> Thanks for the response and I am just using windows authentication on the
> live report server. I enabled the anonymous access in a testing
> environment
> just to try to get around the authentication problems I was encountering.
> My
> issue was that I am developing in a different domain and I am accessing
> the
> report server by IP address. Well when I implemented the application on
> the
> production domain I never changed the report server path to the actual
> report
> server machine name and this caused my authentication problem. Just one
> of
> those little slip ups that seem to cause the biggest problems. Thanks,
> --
> Andrew
> MCSA,MCDBA
> --
> Andrew
> MCSA,MCDBA
>
> "Bruce L-C [MVP]" wrote:
>> If your asp app is on a different machine then I think you are hitting
>> the
>> double hop issue. You need to be using Kerberos to support double hop.
>> This
>> is an IIS issue. Here is a good link:
>> http://support.microsoft.com/default.aspx?scid=kb;en-us;264921
>> I notice that you have enable anonymous on IIS where RS is located. This
>> is
>> a bad idea. It will cause difficulties with managing Report Server.
>> Either
>> you need to setup your security using Kerberos or you will have to
>> implement
>> forms based authentication. If there is another way around it I am not
>> sure
>> what it would be.
>>
>> --
>> Bruce Loehle-Conger
>> MVP SQL Server Reporting Services
>>
>> "Andrew" <Andrew@.discussions.microsoft.com> wrote in message
>> news:60F64653-3B04-4E3C-9ADA-D06A191AB9EE@.microsoft.com...
>> >I am having an authentication problem using the Report Viewer Control.
>> >The
>> > situation is that I have developed a simple ASP.NET application that
>> > will
>> > used as an interface for Report Viewing. First, I have a TreeView
>> > Control
>> > located on the default page that is being populated with the current
>> > reports
>> > that are published on the Report Server. Second, I have a aspx page
>> > called
>> > ReportViewer that holds the Report Viewer Control. Third, when a user
>> > clicks
>> > on one of the reports in the TreeView control the report is generated
>> > in
>> > an
>> > IFrame located in a table cell on the default page.
>> >
>> > My Problem is that everytime I click to generate a report I am asked
>> > for
>> > windows credentials. I am passing the full network credentials(testing
>> > environment going to use an application pool when live and pass default
>> > credentials) example System.Net.NetworkCredential("username",
>> > "password",
>> > "domain") in the load event of both aspx pages and IIS directory
>> > security
>> > is
>> > setup with anonymous access & integrated windows authentication(I have
>> > tried
>> > about everything in IIS Directory Security). I have tried about
>> > everything
>> > and for the life of me cannot get around this issue any assistance
>> > would
>> > be
>> > greatly appreciated.
>> >
>> > Thanks,
>> >
>> > --
>> > Andrew
>> > MCSA,MCDBA
>>|||Andrew wrote:
> Bruce,
> Thanks for the response and I am just using windows authentication on the
> live report server. I enabled the anonymous access in a testing environment
> just to try to get around the authentication problems I was encountering. My
> issue was that I am developing in a different domain and I am accessing the
> report server by IP address. Well when I implemented the application on the
> production domain I never changed the report server path to the actual report
> server machine name and this caused my authentication problem. Just one of
> those little slip ups that seem to cause the biggest problems. Thanks,
Andrew,
you will not be authenticated with IIS if you have anonymous access
enabled.Even if you pass credentials with
System.Net.NetworkCredential(user,pass,domain).

Problem Report Making.

Hi !

I've an table which have 32 Columns. Table will Normally have 15 records. Because in A-4 Size paper 32 Columns cannot appear in single partition. I want to make double partitioned report which contains 16 column with 15 records in upper portion & remaining 16 columns and records in lower half portion.

I've attached word file for example.

How I complete this task ?

thanks in advance.You can use a subreport in this case.
Show columns 1-16 in your main report and 17-32 in a subreport.|||thanks.

I'm using ado .net dataset as a datasource. In the main report dataset showing table schema but in the sub report it is not showing table schema. can u guide me ?|||I guess you've used a cross-tab in your mail report. Right?
Use a cross-tab in your subreport as well.

Monday, March 26, 2012

problem repeating PageHeader using a matrix

Hello there,

I've got a simple report. In the header of the report I have some Informations and I want them to repeat.

In the ReportBody I have a matrix with a lot of colums - so the expand horizontically.
The rows of the matrix fit on one page, they dont cause a page break.

The Problem is, the report doesnt repeat the headers.

I tried to solve this :
putting the matrix in a rectangle
putting the rectangle in a table
using the table header for repetition

The problem now is, the free space between the outer side of the matrix an the right side of the rectangle (report is in landscape format) causes every second page an empty page.

What should I do?

Thanks for every idea. Tobi
I tried something else:

put the matrix in a subreport and the subreport in the table in main report.

same problem: header appears only on first page...
|||No ideas? Where are the specialists?
|||

I have no idea where the specialists are <s>. I am definitely not a matrix specialist.

But you might want to take a look at this thread http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1740217&SiteID=1 for an idea.

In it, we have proposed the idea that you can set up a group on columnset number that does a page break, therefore the requisite headers and left-side columns should repeat as needed.

I have included all the code for deriving the columnset number (in both sql 2000 and 2005 versions <sigh>) in example SQL posted on that thread.

I hope it helps,

>L<

Problem Rendering report via URL

Here's the link:
http://dvws02ms.firm.jonesday.dv:800/Reports/Pages/Report.aspx?ItemPath=%2fCLE+Reports%2ftest&rs:Command=Render&Type=O
My report is called test and it has one report parameter, Type. Somehow if
just keeps prompting me that the parameter is missing. Anybody had problems
with this before? This is the first report I've tried to run with a
parameter through a URL. RS2005............I figured this out. I wasn't pointing to the ReportViewer.aspx page...
"gdjoshua" wrote:
> Here's the link:
> http://dvws02ms.firm.jonesday.dv:800/Reports/Pages/Report.aspx?ItemPath=%2fCLE+Reports%2ftest&rs:Command=Render&Type=O
> My report is called test and it has one report parameter, Type. Somehow if
> just keeps prompting me that the parameter is missing. Anybody had problems
> with this before? This is the first report I've tried to run with a
> parameter through a URL. RS2005............

Problem Rendering Multi Column

I've added a link to a sample on how my test-column report renders.

http://www.leboeuf.be/MSDN/Dagelijkse%20Verkoop%20Merk.pdf

Any idea what's happening, while normally previewing the report (column by page) this problem doesn't occur .... The rendering is the same to TIFF

http://www.leboeuf.be/MSDN/Dagelijkse%20Verkoop%20Merk.tif

Any suggestion on what is the problem and even better, if there is a solution.

Found the problem, the page width exceeded the normal page width op an A4 page, obviously that gives a rendering problem, as soon i dropped 1 column redering was 'normal'

Problem rendering Matrix control

All,

I am able to display the data in matrix, however I need to place it next to a table report item, so that the rows in table and matrix together would represent the data for same entity. In order to accomplish that, the Matrix rows need to be properly aligned with Table rows. But thats not happening. For some reason, in the Layout view they align properly, but when I Preview the report, the rows are not aligned. I have checked the cell sizes of both in the properties, they are both identical. So, I am very surprised why the Matrix row size is growing less than Table row size when the report is generated. Any ideas how to fix this?

Thanks.Never mind, I figured it out. It was nothing, just one of the table cells getting its text wrapped around and making the entire row seem bigger.sql

Problem removing group header

Using SS2000, RS2000, VS2003
I have a report that displays group totals and grand totals but no detail
lines. There is nothing in the group header. I made the height of the group
header as small as possible but there is still too much room between the rows
when the report is run.
I tried removing the group header and that works as far as the space between
rows. However, after removing the group header and running the report, I
noticed that nothing in the report footer was showing up.
Any ideas? Thanks,
--
Dan D.Have you tried setting Group Header's visibility to False?
"Dan D." wrote:
> Using SS2000, RS2000, VS2003
> I have a report that displays group totals and grand totals but no detail
> lines. There is nothing in the group header. I made the height of the group
> header as small as possible but there is still too much room between the rows
> when the report is run.
> I tried removing the group header and that works as far as the space between
> rows. However, after removing the group header and running the report, I
> noticed that nothing in the report footer was showing up.
> Any ideas? Thanks,
> --
> Dan D.|||I tried that and it made the group footer data disappear. Apparently, the
visibility is for the group as a whole and there is no way to make just the
header hidden.
Thanks,
--
Dan D.
"isaak" wrote:
> Have you tried setting Group Header's visibility to False?
> "Dan D." wrote:
> > Using SS2000, RS2000, VS2003
> > I have a report that displays group totals and grand totals but no detail
> > lines. There is nothing in the group header. I made the height of the group
> > header as small as possible but there is still too much room between the rows
> > when the report is run.
> >
> > I tried removing the group header and that works as far as the space between
> > rows. However, after removing the group header and running the report, I
> > noticed that nothing in the report footer was showing up.
> >
> > Any ideas? Thanks,
> > --
> > Dan D.|||Of course you can do this but not from the Edit Group >> Visibility tab. As
you discovered, changing the visibility here affects the whole group.
Make sure the properties window is visible in report designer (menu: View >>
Properties Window) and then select the group header row you want to hide. Now
find the Visibility property in the properties window, expand it and set
Hidden = True.
"Dan D." wrote:
> I tried that and it made the group footer data disappear. Apparently, the
> visibility is for the group as a whole and there is no way to make just the
> header hidden.
> Thanks,
> --
> Dan D.
>
> "isaak" wrote:
> > Have you tried setting Group Header's visibility to False?
> >
> > "Dan D." wrote:
> >
> > > Using SS2000, RS2000, VS2003
> > > I have a report that displays group totals and grand totals but no detail
> > > lines. There is nothing in the group header. I made the height of the group
> > > header as small as possible but there is still too much room between the rows
> > > when the report is run.
> > >
> > > I tried removing the group header and that works as far as the space between
> > > rows. However, after removing the group header and running the report, I
> > > noticed that nothing in the report footer was showing up.
> > >
> > > Any ideas? Thanks,
> > > --
> > > Dan D.|||That did it Jim. Thanks.
--
Dan D.
"Jim" wrote:
> Of course you can do this but not from the Edit Group >> Visibility tab. As
> you discovered, changing the visibility here affects the whole group.
> Make sure the properties window is visible in report designer (menu: View >>
> Properties Window) and then select the group header row you want to hide. Now
> find the Visibility property in the properties window, expand it and set
> Hidden = True.
> "Dan D." wrote:
> > I tried that and it made the group footer data disappear. Apparently, the
> > visibility is for the group as a whole and there is no way to make just the
> > header hidden.
> >
> > Thanks,
> > --
> > Dan D.
> >
> >
> > "isaak" wrote:
> >
> > > Have you tried setting Group Header's visibility to False?
> > >
> > > "Dan D." wrote:
> > >
> > > > Using SS2000, RS2000, VS2003
> > > > I have a report that displays group totals and grand totals but no detail
> > > > lines. There is nothing in the group header. I made the height of the group
> > > > header as small as possible but there is still too much room between the rows
> > > > when the report is run.
> > > >
> > > > I tried removing the group header and that works as far as the space between
> > > > rows. However, after removing the group header and running the report, I
> > > > noticed that nothing in the report footer was showing up.
> > > >
> > > > Any ideas? Thanks,
> > > > --
> > > > Dan D.|||Well, this is weird. I just noticed that when I change the visibility on the
group header to false, the report header and footer both disappear, like
they've also been changed to false. I don't see a visibility setting for the
report header and footer under properties, though. Do you have any idea what
happened? If I change the visibility of the group header back to true, the
report header and footer both appear again.
--
Dan D.
"Jim" wrote:
> Of course you can do this but not from the Edit Group >> Visibility tab. As
> you discovered, changing the visibility here affects the whole group.
> Make sure the properties window is visible in report designer (menu: View >>
> Properties Window) and then select the group header row you want to hide. Now
> find the Visibility property in the properties window, expand it and set
> Hidden = True.
> "Dan D." wrote:
> > I tried that and it made the group footer data disappear. Apparently, the
> > visibility is for the group as a whole and there is no way to make just the
> > header hidden.
> >
> > Thanks,
> > --
> > Dan D.
> >
> >
> > "isaak" wrote:
> >
> > > Have you tried setting Group Header's visibility to False?
> > >
> > > "Dan D." wrote:
> > >
> > > > Using SS2000, RS2000, VS2003
> > > > I have a report that displays group totals and grand totals but no detail
> > > > lines. There is nothing in the group header. I made the height of the group
> > > > header as small as possible but there is still too much room between the rows
> > > > when the report is run.
> > > >
> > > > I tried removing the group header and that works as far as the space between
> > > > rows. However, after removing the group header and running the report, I
> > > > noticed that nothing in the report footer was showing up.
> > > >
> > > > Any ideas? Thanks,
> > > > --
> > > > Dan D.sql

problem recreating a report - 2nd dataset doesn't exist?

Hello,
I am just starting out with reporting services (I have a book which I have
not read yet). I have copied the basic part of a report to a new report for
learning purposes. This contains a parameter which I included in the query.
This works so far. But the original report also includes a table of fields
that are based on a separate dataset. I am getting an error now. How do I
add/imlement this secondary dataset? The error message says that this
dataset does not exist. I presume it means the dataset does not exist in the
report because the tables in sql server exist. How do I create this dataset?
Thanks,
Richopen report project by using visual studio
open report document (double click the report file - solution explorer)
go to Data tab (Data / Layout / Preview)
click dataset dropdown and choose <new dataset...>
have fun
"Rich" <Rich@.discussions.microsoft.com> escreveu na mensagem
news:D8EE2D83-6A8B-49AF-B875-DF9191DAD51A@.microsoft.com...
> Hello,
> I am just starting out with reporting services (I have a book which I have
> not read yet). I have copied the basic part of a report to a new report
> for
> learning purposes. This contains a parameter which I included in the
> query.
> This works so far. But the original report also includes a table of
> fields
> that are based on a separate dataset. I am getting an error now. How do
> I
> add/imlement this secondary dataset? The error message says that this
> dataset does not exist. I presume it means the dataset does not exist in
> the
> report because the tables in sql server exist. How do I create this
> dataset?
> Thanks,
> Rich|||Nevermind. I figured it out. Goto Data, New Dataset.
I didn't check the entire list of datasets in the original report.
"Rich" wrote:
> Hello,
> I am just starting out with reporting services (I have a book which I have
> not read yet). I have copied the basic part of a report to a new report for
> learning purposes. This contains a parameter which I included in the query.
> This works so far. But the original report also includes a table of fields
> that are based on a separate dataset. I am getting an error now. How do I
> add/imlement this secondary dataset? The error message says that this
> dataset does not exist. I presume it means the dataset does not exist in the
> report because the tables in sql server exist. How do I create this dataset?
> Thanks,
> Rich|||Thanks. I am sort of having fun. At least I can get my report to run.
Note: I am outputting this report in Excel format. The first set of fields
(about 3 of them) are based on the first dataset - the master data. Then I
have the 2nd dataset which is the detail data (about 6 fields). When I run
the report (outside of VS, like from an Access database app) the first
dataset displays on the first sheet of an Excel workbook, but the 2nd
dataset, the detail data, is displaying on a 2nd Excel sheet. How can I keep
the detail data on the same sheet as the master data? Is there something I
need to do in the Layout view in VS?
Thanks,
Rich
"Ricardo" wrote:
> open report project by using visual studio
> open report document (double click the report file - solution explorer)
> go to Data tab (Data / Layout / Preview)
> click dataset dropdown and choose <new dataset...>
> have fun
> "Rich" <Rich@.discussions.microsoft.com> escreveu na mensagem
> news:D8EE2D83-6A8B-49AF-B875-DF9191DAD51A@.microsoft.com...
> > Hello,
> >
> > I am just starting out with reporting services (I have a book which I have
> > not read yet). I have copied the basic part of a report to a new report
> > for
> > learning purposes. This contains a parameter which I included in the
> > query.
> > This works so far. But the original report also includes a table of
> > fields
> > that are based on a separate dataset. I am getting an error now. How do
> > I
> > add/imlement this secondary dataset? The error message says that this
> > dataset does not exist. I presume it means the dataset does not exist in
> > the
> > report because the tables in sql server exist. How do I create this
> > dataset?
> >
> > Thanks,
> > Rich
>
>

Friday, March 23, 2012

Problem printing on two page

Hi again! Now that I have fix with your help, my layout problem, I got a new one. LOL!!!!

Now my problem is when data in a report need to go on two page. The printer's give me a header on one page and a body on a second page instead of a header with a part of the body and the rest on a second page with a repeating of the header.

Following me?

Now can you help me?

Thanks in advance.

Daniel

Yes, I follow. You can select "Repeat header" from report properties.|||Hi! I don't have this options in my report properties. I'm using SQL 2005.|||

Click in your report body to show the tabular report table (unless you chose matrix), then right-click on the upper left corner of the report table and select properties. On the table properties general tab, under the Header / Footer section, you can check the box to repeat header columns on each page.

|||

No! I'm not getting that. But I think it might be these properties set to true going like that:

Page Headers:

Print on first page = true

Print on last page = true

same for footer. Logically if it's on the first and the last, it's on each page.

|||

No, that property is for page headers. What you need to repeat are the table header rows. Which part of the instructions above did not work for you?

|||I understand most of what I'm reading in english. Maybe I'm not at the right place. I'm using for developping my report VSS 2005, not the http://<ServerName>/reports tool. Is this make a difference?|||

You are using the correct tool, Visual Studio 2005 (with Business Intelligence projects) or SQL Server Business Intelligence Development Studio which are very similar. If you can supply an e-mail address, I will send you some screen shots to go with the instructions above?

|||

Good idea! I was telling to my self why we can't post screenshot...

Write me at dlusignan@.fmoq.org

Thanks you very much.

|||

It would be nice, however, I'm sure it is do to space limiations. I just sent you a MS Word document with the explanation and screen shots. I hope this helps.

sql

Problem Printing local report in Sql reporting services

I have a local report for which i am binding the Dataset dynamically. I am trying to print this report using a seperate button on the page. I saw in the forums saying that the reportviewer can be converted to an EMF file, bind this to an image control and can Print this image using Javascript.

Can anyone help me with the sample code to print local report from the reportviewer (it may be in any approach.)

Thanks in advance.

Sekhar TThis thread should help.

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=790287&SiteID=1&mode=1&PageID=0

or at least get you on the right path.|||

Am sorry, my app is not windows, it is web based

I tried it but didn't help me a lot. My requirement is to allow clients to print reports from their browsers. I am using a single reportviewer control to display reports by dynamically binding different business objects and reports. One important thing to notice is that my connection string changes on user selection.

I am not really sure if there is another way using server mode to do this. I don't want to create reports to each database on the server. I am looking for a solution where i can use the same report for different databases.

|||When you say "One important thing to notice is that my connection string changes on user selection." you mean you're connecting to different reporting servers?

Here's my class. at the moment i'm confused as to why the 2nd device info has a start page of + 1 where the 1st one is set to 0. But it should work for you, assuming you know how to change the properties on each report server, aka changing the reportview.serverreport.reportpath, and the reportview.serverreport.reportserverurl. (these contain the same info as the connection string)

Hope this helps.

using System;
using System.IO;
using System.Data;
using System.Text;
using System.Drawing.Imaging;
using System.Drawing.Printing;
using System.Collections.Generic;
using System.Collections.Specialized;
using Microsoft.Reporting.WebForms;
using Microsoft.Reporting;
using System.Drawing;
public partial class _Default : System.Web.UI.Page
{

protected void Page_Load(object sender, EventArgs e)
{
Demo demo = new Demo();
demo.Run();
}
}

public class Demo : IDisposable
{

private int m_currentPageIndex;
private IList<Stream> m_streams;

private void Export(ServerReport report)
{
string deviceInfo =
"<DeviceInfo>" +
"<OutputFormat>EMF</OutputFormat>" +
" <MarginTop>0.25in</MarginTop>" +
" <MarginLeft>0.25in</MarginLeft>" +
" <MarginRight>0.25in</MarginRight>" +
" <MarginBottom>0.25in</MarginBottom>" +
" <StartPage>0</StartPage>" +
"</DeviceInfo>";

m_streams = new List<Stream>();

string encoding;
string mimeType;
string extension;
Warning[] warnings;
string[] streamIDs = null;
Byte[][] pages = null;

//Create Byte array containing the rendered image. of the 1st page.
Byte[] firstPage = report.Render("Image", deviceInfo, out mimeType, out encoding, out extension, out streamIDs, out warnings);

m_streams.Add(new MemoryStream(firstPage));

// The total number of pages of the report is 1 + the streamIDs
int m_numberOfPages = streamIDs.Length + 1;
pages = new Byte[m_numberOfPages][];

// The first page was already rendered
pages[0] = firstPage;

for (int pageIndex = 1; pageIndex < m_numberOfPages; pageIndex++)
{
// Build device info based on start page
deviceInfo = String.Format(
"<DeviceInfo>" +
"<OutputFormat>EMF</OutputFormat>" +
" <MarginTop>0.25in</MarginTop>" +
" <MarginLeft>0.25in</MarginLeft>" +
" <MarginRight>0.25in</MarginRight>" +
" <MarginBottom>0.25in</MarginBottom>" +
" <StartPage>{0}</StartPage>" +
"</DeviceInfo>", pageIndex+1);

//Render the page to a byte array.
pages[pageIndex] = report.Render("Image", deviceInfo, out mimeType, out encoding, out extension, out streamIDs, out warnings);

//create a stream of the page's byte array
m_streams.Add(new MemoryStream(pages[pageIndex]));

//set the position of the stream to 0 to make sure when the stream is read
//it starts from the beginning.
m_streams[m_streams.Count-1].Position = 0;
}

m_currentPageIndex = 0;
}

private void PrintPage(object sender, PrintPageEventArgs ev)
{
//create a new metafile based on the page that we're trying to print.
Metafile pageImage = new Metafile(m_streams[m_currentPageIndex]);

//draw the an image deciding what to draw, and where to place it on the page.
ev.Graphics.DrawImage(pageImage, 0, 0);
//increment to the next page.
m_currentPageIndex++;

//decide if we've read our last stream.
ev.HasMorePages = (m_currentPageIndex < m_streams.Count);
}

private void Print()
{
//the name of the printer.
const string printerName = "Microsoft Office Document Image Writer";//;"\\\\NPSERVER\\MAIN"

//if there's nothing to print return
if (m_streams == null || m_streams.Count == 0)
return;

//create the printdocument object
PrintDocument printDoc = new PrintDocument();

//set the printername, deal w/ the printer being invalid
printDoc.PrinterSettings.PrinterName = printerName;
if (!printDoc.PrinterSettings.IsValid)
{
string msg = String.Format("Can't find printer \"{0}\".", printerName);
System.Diagnostics.Debug.WriteLine(msg);
return;
}
//attatch an event handler that will fire for each page that is printed.
printDoc.PrintPage += new PrintPageEventHandler(PrintPage);
//call print method, which get's the process going and ultimately calls the printpage method via the eventhandler.
printDoc.Print();
}

public void Run()
{
//create a new reportviewer object
ReportViewer rv = new ReportViewer();

//set the serverreport properties
rv.ServerReport.ReportPath = "/CRAMReports/ConcentrationReport";
rv.ServerReport.ReportServerUrl = new System.Uri("http://localhost/reportserver");

//configure params
List<ReportParameter> myParams = new List<ReportParameter>();
ReportParameter param = new ReportParameter("NAV", "0", false);
myParams.Add(param);
//set the params based on the param list.
rv.ServerReport.SetParameters(myParams);

//call the export method that builds the stream list.
Export(rv.ServerReport);

//call the print funciton
Print();

//call dispose which closes all the streams.
Dispose();
}

public void Dispose()
{
if (m_streams != null)
{
foreach (Stream stream in m_streams)
stream.Close();
}
}
}
|||

I am using reportviewer in local mode, where i am not using sql reporting server.

what i meant saying different connection strings is for different business objects from different databases in sql server 2005. we have different databases in sql server 2005.

Does your solution print from the browser? shall give it a try now

Thnks


|||

Hi, i have add that code

and everything is very good when i run it local through the visual Studio 2005

but when i upload the Application and run it thought the IIS the printing doent work and i dont know why.

Note: i am using local report.

i hope any one help coz i need it so much

|||

Hi, i have add that code

and everything is very good when i run it local through the visual Studio 2005

but when i upload the Application and run it thought the IIS the printing doent work and i dont know why.

Note: i am using local report.

|||What type of printers do you have? What are the print drivers?|||

hi,

i dont know if i understand your question well or not but iam using printer HP DeskJet 1220C from my client PC,

i hope i answer your question ,

i hope you help me soon because i need this part so much.

Maylo

|||

Guys,

There seem to be a couple of confusions here (I may be misreading the messages, but I'm going to give this a try anyway).

1. Sekhar T, even though you are using "local mode", not server mode, it's not like the actual databinding is happening on the client. It's happening on your web server. So to my mind the fact that you are dynamically binding is not all that relevant. You have the same opportunity in a "separate button" as you do when the page is normally posted back, to evaluate the user's needs and re-bind.

2. While it is true that report pages can be rendered to EMF, that doesn't make sense in your case. First, because you would be doing that on the web server (which has nothing to do with printing in the browser, agreed) and second, because I am not sure localmode reports can render to EMFs.

3. *HOWEVER* localmode reports can render to PDFs and of course PDFs can be easily printed by the user. While the user can already export to PDF from the reportviewer interface, you can in fact use a separate button for this purpose on the web page. See code below; I will include some binding code.

Code Snippet

Partial Class pages_Default

Inherits System.Web.UI.Page

' here's a sketch of how to send the PDF

' back from your separate button

Protected Sub Button1_Click( _

ByVal sender As Object, ByVal e As System.EventArgs) _

Handles Button1.Click

Dim buffer As Byte(), f As String, fs As System.IO.FileStream

f = System.IO.Path.GetTempFileName()

System.IO.Path.ChangeExtension(f, "PDF")

' there is probably a better way to set up the rendered PDF

' for redirecting to the Response output, but this one works.

' here is the binding bit. Revise to suit your dynamic situation.

' if you aren't really dynamically binding data against one

' loaded report, but rather changing

' reports to suit the user's needs, that will work too.

Dim ReportDataSourceX = _

New Microsoft.Reporting.WebForms.ReportDataSource()

ReportDataSourceX.Name = "DataSet1_Recipient"

ReportDataSourceX.Value = Me.SqlDataSource1

With Me.ReportViewer1.LocalReport

.DataSources.Clear()

.DataSources.Add(ReportDataSourceX)

buffer = .Render("PDF", Nothing, Nothing, Nothing, _

Nothing, Nothing, Nothing)

End With

fs = New System.IO.FileStream(f, System.IO.FileMode.Create)

fs.Write(buffer, 0, buffer.Length)

fs.Close()

fs.Dispose()

Response.ContentType = "Application/pdf"

Response.WriteFile(f)

Response.End()

System.IO.File.Delete(f)

End Sub

End Class

4. I am not so sure that it makes sense to have the separate button actually do the printing instead of bringing back the PDF and having the user print. If the user has to push a button anyway, shouldn't the user be able to make the normal printing decisions (such as what printer and features to use)? This is kind of the nature of a browser-based application.

5. If you really wanted javascript to print, the code would be a little different than what you see below, but not all that much. Instead of being a server-side control, I would use a "regular" button. The client side script would post to a URL that contained the required information for this user to get the report and data the way the user needed it. The client side script would receive back this data from its post and then probably save the file locally, finally sending the file out to the printer. However I don'tt think this is going to work in a whole bunch of security-limited cases. It requires too much control by script in the browser complex. Try what I"m suggesting in points 3 and 4, please, and think it over...

HTH,

>L<

Problem Printing local report in Sql reporting services

I have a local report for which i am binding the Dataset dynamically. I am trying to print this report using a seperate button on the page. I saw in the forums saying that the reportviewer can be converted to an EMF file, bind this to an image control and can Print this image using Javascript.

Can anyone help me with the sample code to print local report from the reportviewer (it may be in any approach.)

Thanks in advance.

Sekhar T
This thread should help.

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=790287&SiteID=1&mode=1&PageID=0

or at least get you on the right path.
|||

Am sorry, my app is not windows, it is web based

I tried it but didn't help me a lot. My requirement is to allow clients to print reports from their browsers. I am using a single reportviewer control to display reports by dynamically binding different business objects and reports. One important thing to notice is that my connection string changes on user selection.

I am not really sure if there is another way using server mode to do this. I don't want to create reports to each database on the server. I am looking for a solution where i can use the same report for different databases.

|||When you say "One important thing to notice is that my connection string changes on user selection." you mean you're connecting to different reporting servers?

Here's my class. at the moment i'm confused as to why the 2nd device info has a start page of + 1 where the 1st one is set to 0. But it should work for you, assuming you know how to change the properties on each report server, aka changing the reportview.serverreport.reportpath, and the reportview.serverreport.reportserverurl. (these contain the same info as the connection string)

Hope this helps.

using System;
using System.IO;
using System.Data;
using System.Text;
using System.Drawing.Imaging;
using System.Drawing.Printing;
using System.Collections.Generic;
using System.Collections.Specialized;
using Microsoft.Reporting.WebForms;
using Microsoft.Reporting;
using System.Drawing;
public partial class _Default : System.Web.UI.Page
{

protected void Page_Load(object sender, EventArgs e)
{
Demo demo = new Demo();
demo.Run();
}
}

public class Demo : IDisposable
{

private int m_currentPageIndex;
private IList<Stream> m_streams;

private void Export(ServerReport report)
{
string deviceInfo =
"<DeviceInfo>" +
"<OutputFormat>EMF</OutputFormat>" +
" <MarginTop>0.25in</MarginTop>" +
" <MarginLeft>0.25in</MarginLeft>" +
" <MarginRight>0.25in</MarginRight>" +
" <MarginBottom>0.25in</MarginBottom>" +
" <StartPage>0</StartPage>" +
"</DeviceInfo>";
m_streams = new List<Stream>();

string encoding;
string mimeType;
string extension;
Warning[] warnings;
string[] streamIDs = null;
Byte[][] pages = null;

//Create Byte array containing the rendered image. of the 1st page.
Byte[] firstPage = report.Render("Image", deviceInfo, out mimeType, out encoding, out extension, out streamIDs, out warnings);

m_streams.Add(new MemoryStream(firstPage));

// The total number of pages of the report is 1 + the streamIDs
int m_numberOfPages = streamIDs.Length + 1;
pages = new Byte[m_numberOfPages][];

// The first page was already rendered
pages[0] = firstPage;

for (int pageIndex = 1; pageIndex < m_numberOfPages; pageIndex++)
{
// Build device info based on start page
deviceInfo = String.Format(
"<DeviceInfo>" +
"<OutputFormat>EMF</OutputFormat>" +
" <MarginTop>0.25in</MarginTop>" +
" <MarginLeft>0.25in</MarginLeft>" +
" <MarginRight>0.25in</MarginRight>" +
" <MarginBottom>0.25in</MarginBottom>" +
" <StartPage>{0}</StartPage>" +
"</DeviceInfo>", pageIndex+1);

//Render the page to a byte array.
pages[pageIndex] = report.Render("Image", deviceInfo, out mimeType, out encoding, out extension, out streamIDs, out warnings);

//create a stream of the page's byte array
m_streams.Add(new MemoryStream(pages[pageIndex]));

//set the position of the stream to 0 to make sure when the stream is read
//it starts from the beginning.
m_streams[m_streams.Count-1].Position = 0;
}

m_currentPageIndex = 0;
}

private void PrintPage(object sender, PrintPageEventArgs ev)
{
//create a new metafile based on the page that we're trying to print.
Metafile pageImage = new Metafile(m_streams[m_currentPageIndex]);

//draw the an image deciding what to draw, and where to place it on the page.
ev.Graphics.DrawImage(pageImage, 0, 0);
//increment to the next page.
m_currentPageIndex++;

//decide if we've read our last stream.
ev.HasMorePages = (m_currentPageIndex < m_streams.Count);
}

private void Print()
{
//the name of the printer.
const string printerName = "Microsoft Office Document Image Writer";//;"\\\\NPSERVER\\MAIN"

//if there's nothing to print return
if (m_streams == null || m_streams.Count == 0)
return;

//create the printdocument object
PrintDocument printDoc = new PrintDocument();

//set the printername, deal w/ the printer being invalid
printDoc.PrinterSettings.PrinterName = printerName;
if (!printDoc.PrinterSettings.IsValid)
{
string msg = String.Format("Can't find printer \"{0}\".", printerName);
System.Diagnostics.Debug.WriteLine(msg);
return;
}
//attatch an event handler that will fire for each page that is printed.
printDoc.PrintPage += new PrintPageEventHandler(PrintPage);
//call print method, which get's the process going and ultimately calls the printpage method via the eventhandler.
printDoc.Print();
}

public void Run()
{
//create a new reportviewer object
ReportViewer rv = new ReportViewer();

//set the serverreport properties
rv.ServerReport.ReportPath = "/CRAMReports/ConcentrationReport";
rv.ServerReport.ReportServerUrl = new System.Uri("http://localhost/reportserver");

//configure params
List<ReportParameter> myParams = new List<ReportParameter>();
ReportParameter param = new ReportParameter("NAV", "0", false);
myParams.Add(param);
//set the params based on the param list.
rv.ServerReport.SetParameters(myParams);

//call the export method that builds the stream list.
Export(rv.ServerReport);

//call the print funciton
Print();

//call dispose which closes all the streams.
Dispose();
}

public void Dispose()
{
if (m_streams != null)
{
foreach (Stream stream in m_streams)
stream.Close();
}
}
}
|||

I am using reportviewer in local mode, where i am not using sql reporting server.

what i meant saying different connection strings is for different business objects from different databases in sql server 2005. we have different databases in sql server 2005.

Does your solution print from the browser? shall give it a try now

Thnks


|||

Hi, i have add that code

and everything is very good when i run it local through the visual Studio 2005

but when i upload the Application and run it thought the IIS the printing doent work and i dont know why.

Note: i am using local report.

i hope any one help coz i need it so much

|||

Hi, i have add that code

and everything is very good when i run it local through the visual Studio 2005

but when i upload the Application and run it thought the IIS the printing doent work and i dont know why.

Note: i am using local report.

|||What type of printers do you have? What are the print drivers?|||

hi,

i dont know if i understand your question well or not but iam using printer HP DeskJet 1220C from my client PC,

i hope i answer your question ,

i hope you help me soon because i need this part so much.

Maylo

|||

Guys,

There seem to be a couple of confusions here (I may be misreading the messages, but I'm going to give this a try anyway).

1. Sekhar T, even though you are using "local mode", not server mode, it's not like the actual databinding is happening on the client. It's happening on your web server. So to my mind the fact that you are dynamically binding is not all that relevant. You have the same opportunity in a "separate button" as you do when the page is normally posted back, to evaluate the user's needs and re-bind.

2. While it is true that report pages can be rendered to EMF, that doesn't make sense in your case. First, because you would be doing that on the web server (which has nothing to do with printing in the browser, agreed) and second, because I am not sure localmode reports can render to EMFs.

3. *HOWEVER* localmode reports can render to PDFs and of course PDFs can be easily printed by the user. While the user can already export to PDF from the reportviewer interface, you can in fact use a separate button for this purpose on the web page. See code below; I will include some binding code.

Code Snippet

PartialClass pages_Default

Inherits System.Web.UI.Page

' here's a sketch of how to send the PDF

' back from your separate button

ProtectedSub Button1_Click( _

ByVal sender AsObject, ByVal e As System.EventArgs) _

Handles Button1.Click

Dim buffer AsByte(), f AsString, fs As System.IO.FileStream

f = System.IO.Path.GetTempFileName()

System.IO.Path.ChangeExtension(f, "PDF")

' there is probably a better way to set up the rendered PDF

' for redirecting to the Response output, but this one works.

' here is the binding bit. Revise to suit your dynamic situation.

' if you aren't really dynamically binding data against one

' loaded report, but rather changing

' reports to suit the user's needs, that will work too.

Dim ReportDataSourceX = _

New Microsoft.Reporting.WebForms.ReportDataSource()

ReportDataSourceX.Name = "DataSet1_Recipient"

ReportDataSourceX.Value = Me.SqlDataSource1

WithMe.ReportViewer1.LocalReport

.DataSources.Clear()

.DataSources.Add(ReportDataSourceX)

buffer = .Render("PDF", Nothing, Nothing, Nothing, _

Nothing, Nothing, Nothing)

EndWith

fs = New System.IO.FileStream(f, System.IO.FileMode.Create)

fs.Write(buffer, 0, buffer.Length)

fs.Close()

fs.Dispose()

Response.ContentType = "Application/pdf"

Response.WriteFile(f)

Response.End()

System.IO.File.Delete(f)

EndSub

EndClass

4. I am not so sure that it makes sense to have the separate button actually do the printing instead of bringing back the PDF and having the user print. If the user has to push a button anyway, shouldn't the user be able to make the normal printing decisions (such as what printer and features to use)? This is kind of the nature of a browser-based application.

5. If you really wanted javascript to print, the code would be a little different than what you see below, but not all that much. Instead of being a server-side control, I would use a "regular" button. The client side script would post to a URL that contained the required information for this user to get the report and data the way the user needed it. The client side script would receive back this data from its post and then probably save the file locally, finally sending the file out to the printer. However I don'tt think this is going to work in a whole bunch of security-limited cases. It requires too much control by script in the browser complex. Try what I"m suggesting in points 3 and 4, please, and think it over...

HTH,

>L<

Problem Printing local report in Sql reporting services

I have a local report for which i am binding the Dataset dynamically. I am trying to print this report using a seperate button on the page. I saw in the forums saying that the reportviewer can be converted to an EMF file, bind this to an image control and can Print this image using Javascript.

Can anyone help me with the sample code to print local report from the reportviewer (it may be in any approach.)

Thanks in advance.

Sekhar T
This thread should help.

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=790287&SiteID=1&mode=1&PageID=0

or at least get you on the right path.
|||

Am sorry, my app is not windows, it is web based

I tried it but didn't help me a lot. My requirement is to allow clients to print reports from their browsers. I am using a single reportviewer control to display reports by dynamically binding different business objects and reports. One important thing to notice is that my connection string changes on user selection.

I am not really sure if there is another way using server mode to do this. I don't want to create reports to each database on the server. I am looking for a solution where i can use the same report for different databases.

|||When you say "One important thing to notice is that my connection string changes on user selection." you mean you're connecting to different reporting servers?

Here's my class. at the moment i'm confused as to why the 2nd device info has a start page of + 1 where the 1st one is set to 0. But it should work for you, assuming you know how to change the properties on each report server, aka changing the reportview.serverreport.reportpath, and the reportview.serverreport.reportserverurl. (these contain the same info as the connection string)

Hope this helps.

using System;
using System.IO;
using System.Data;
using System.Text;
using System.Drawing.Imaging;
using System.Drawing.Printing;
using System.Collections.Generic;
using System.Collections.Specialized;
using Microsoft.Reporting.WebForms;
using Microsoft.Reporting;
using System.Drawing;
public partial class _Default : System.Web.UI.Page
{

protected void Page_Load(object sender, EventArgs e)
{
Demo demo = new Demo();
demo.Run();
}
}

public class Demo : IDisposable
{

private int m_currentPageIndex;
private IList<Stream> m_streams;

private void Export(ServerReport report)
{
string deviceInfo =
"<DeviceInfo>" +
"<OutputFormat>EMF</OutputFormat>" +
" <MarginTop>0.25in</MarginTop>" +
" <MarginLeft>0.25in</MarginLeft>" +
" <MarginRight>0.25in</MarginRight>" +
" <MarginBottom>0.25in</MarginBottom>" +
" <StartPage>0</StartPage>" +
"</DeviceInfo>";
m_streams = new List<Stream>();

string encoding;
string mimeType;
string extension;
Warning[] warnings;
string[] streamIDs = null;
Byte[][] pages = null;

//Create Byte array containing the rendered image. of the 1st page.
Byte[] firstPage = report.Render("Image", deviceInfo, out mimeType, out encoding, out extension, out streamIDs, out warnings);

m_streams.Add(new MemoryStream(firstPage));

// The total number of pages of the report is 1 + the streamIDs
int m_numberOfPages = streamIDs.Length + 1;
pages = new Byte[m_numberOfPages][];

// The first page was already rendered
pages[0] = firstPage;

for (int pageIndex = 1; pageIndex < m_numberOfPages; pageIndex++)
{
// Build device info based on start page
deviceInfo = String.Format(
"<DeviceInfo>" +
"<OutputFormat>EMF</OutputFormat>" +
" <MarginTop>0.25in</MarginTop>" +
" <MarginLeft>0.25in</MarginLeft>" +
" <MarginRight>0.25in</MarginRight>" +
" <MarginBottom>0.25in</MarginBottom>" +
" <StartPage>{0}</StartPage>" +
"</DeviceInfo>", pageIndex+1);

//Render the page to a byte array.
pages[pageIndex] = report.Render("Image", deviceInfo, out mimeType, out encoding, out extension, out streamIDs, out warnings);

//create a stream of the page's byte array
m_streams.Add(new MemoryStream(pages[pageIndex]));

//set the position of the stream to 0 to make sure when the stream is read
//it starts from the beginning.
m_streams[m_streams.Count-1].Position = 0;
}

m_currentPageIndex = 0;
}

private void PrintPage(object sender, PrintPageEventArgs ev)
{
//create a new metafile based on the page that we're trying to print.
Metafile pageImage = new Metafile(m_streams[m_currentPageIndex]);

//draw the an image deciding what to draw, and where to place it on the page.
ev.Graphics.DrawImage(pageImage, 0, 0);
//increment to the next page.
m_currentPageIndex++;

//decide if we've read our last stream.
ev.HasMorePages = (m_currentPageIndex < m_streams.Count);
}

private void Print()
{
//the name of the printer.
const string printerName = "Microsoft Office Document Image Writer";//;"\\\\NPSERVER\\MAIN"

//if there's nothing to print return
if (m_streams == null || m_streams.Count == 0)
return;

//create the printdocument object
PrintDocument printDoc = new PrintDocument();

//set the printername, deal w/ the printer being invalid
printDoc.PrinterSettings.PrinterName = printerName;
if (!printDoc.PrinterSettings.IsValid)
{
string msg = String.Format("Can't find printer \"{0}\".", printerName);
System.Diagnostics.Debug.WriteLine(msg);
return;
}
//attatch an event handler that will fire for each page that is printed.
printDoc.PrintPage += new PrintPageEventHandler(PrintPage);
//call print method, which get's the process going and ultimately calls the printpage method via the eventhandler.
printDoc.Print();
}

public void Run()
{
//create a new reportviewer object
ReportViewer rv = new ReportViewer();

//set the serverreport properties
rv.ServerReport.ReportPath = "/CRAMReports/ConcentrationReport";
rv.ServerReport.ReportServerUrl = new System.Uri("http://localhost/reportserver");

//configure params
List<ReportParameter> myParams = new List<ReportParameter>();
ReportParameter param = new ReportParameter("NAV", "0", false);
myParams.Add(param);
//set the params based on the param list.
rv.ServerReport.SetParameters(myParams);

//call the export method that builds the stream list.
Export(rv.ServerReport);

//call the print funciton
Print();

//call dispose which closes all the streams.
Dispose();
}

public void Dispose()
{
if (m_streams != null)
{
foreach (Stream stream in m_streams)
stream.Close();
}
}
}
|||

I am using reportviewer in local mode, where i am not using sql reporting server.

what i meant saying different connection strings is for different business objects from different databases in sql server 2005. we have different databases in sql server 2005.

Does your solution print from the browser? shall give it a try now

Thnks


|||

Hi, i have add that code

and everything is very good when i run it local through the visual Studio 2005

but when i upload the Application and run it thought the IIS the printing doent work and i dont know why.

Note: i am using local report.

i hope any one help coz i need it so much

|||

Hi, i have add that code

and everything is very good when i run it local through the visual Studio 2005

but when i upload the Application and run it thought the IIS the printing doent work and i dont know why.

Note: i am using local report.

|||What type of printers do you have? What are the print drivers?|||

hi,

i dont know if i understand your question well or not but iam using printer HP DeskJet 1220C from my client PC,

i hope i answer your question ,

i hope you help me soon because i need this part so much.

Maylo

|||

Guys,

There seem to be a couple of confusions here (I may be misreading the messages, but I'm going to give this a try anyway).

1. Sekhar T, even though you are using "local mode", not server mode, it's not like the actual databinding is happening on the client. It's happening on your web server. So to my mind the fact that you are dynamically binding is not all that relevant. You have the same opportunity in a "separate button" as you do when the page is normally posted back, to evaluate the user's needs and re-bind.

2. While it is true that report pages can be rendered to EMF, that doesn't make sense in your case. First, because you would be doing that on the web server (which has nothing to do with printing in the browser, agreed) and second, because I am not sure localmode reports can render to EMFs.

3. *HOWEVER* localmode reports can render to PDFs and of course PDFs can be easily printed by the user. While the user can already export to PDF from the reportviewer interface, you can in fact use a separate button for this purpose on the web page. See code below; I will include some binding code.

Code Snippet

Partial Class pages_Default

Inherits System.Web.UI.Page

' here's a sketch of how to send the PDF

' back from your separate button

Protected Sub Button1_Click( _

ByVal sender As Object, ByVal e As System.EventArgs) _

Handles Button1.Click

Dim buffer As Byte(), f As String, fs As System.IO.FileStream

f = System.IO.Path.GetTempFileName()

System.IO.Path.ChangeExtension(f, "PDF")

' there is probably a better way to set up the rendered PDF

' for redirecting to the Response output, but this one works.

' here is the binding bit. Revise to suit your dynamic situation.

' if you aren't really dynamically binding data against one

' loaded report, but rather changing

' reports to suit the user's needs, that will work too.

Dim ReportDataSourceX = _

New Microsoft.Reporting.WebForms.ReportDataSource()

ReportDataSourceX.Name = "DataSet1_Recipient"

ReportDataSourceX.Value = Me.SqlDataSource1

With Me.ReportViewer1.LocalReport

.DataSources.Clear()

.DataSources.Add(ReportDataSourceX)

buffer = .Render("PDF", Nothing, Nothing, Nothing, _

Nothing, Nothing, Nothing)

End With

fs = New System.IO.FileStream(f, System.IO.FileMode.Create)

fs.Write(buffer, 0, buffer.Length)

fs.Close()

fs.Dispose()

Response.ContentType = "Application/pdf"

Response.WriteFile(f)

Response.End()

System.IO.File.Delete(f)

End Sub

End Class

4. I am not so sure that it makes sense to have the separate button actually do the printing instead of bringing back the PDF and having the user print. If the user has to push a button anyway, shouldn't the user be able to make the normal printing decisions (such as what printer and features to use)? This is kind of the nature of a browser-based application.

5. If you really wanted javascript to print, the code would be a little different than what you see below, but not all that much. Instead of being a server-side control, I would use a "regular" button. The client side script would post to a URL that contained the required information for this user to get the report and data the way the user needed it. The client side script would receive back this data from its post and then probably save the file locally, finally sending the file out to the printer. However I don'tt think this is going to work in a whole bunch of security-limited cases. It requires too much control by script in the browser complex. Try what I"m suggesting in points 3 and 4, please, and think it over...

HTH,

>L<

Problem Printing Labels using subreports

Hi,
I have a report for printing order delivery labels. Each order can have
multiple delivery addresses, so this is a nested report with the order report
running first and then the delivery address report running as a sub-report.
The problem is that I want to set the labels so that up to 4 different
delivery addresses for the same order could be printed on a single page.
I am not sure how to set the layout of the sub report, currently it prints
each delivery address 4 times on a page as opposed to 4 different delivery
addresses.
If the order had 5 different delivery addresses, I would need the first page
to show the first 4 and the second page to just show 1 address with 3 blank
labels.
Has anyone any experience of this or does anyone know how to set this up?When I needed to print labels, I found a site that had premade report
templates that saved me a bunch of time.
http://www.reportpax.com
They should work in your case. The only drawback is that you have to pay for
them but the support was good.
"shane" wrote:
> Hi,
> I have a report for printing order delivery labels. Each order can have
> multiple delivery addresses, so this is a nested report with the order report
> running first and then the delivery address report running as a sub-report.
> The problem is that I want to set the labels so that up to 4 different
> delivery addresses for the same order could be printed on a single page.
> I am not sure how to set the layout of the sub report, currently it prints
> each delivery address 4 times on a page as opposed to 4 different delivery
> addresses.
> If the order had 5 different delivery addresses, I would need the first page
> to show the first 4 and the second page to just show 1 address with 3 blank
> labels.
> Has anyone any experience of this or does anyone know how to set this up?
>

Problem Printing

Hi

I have a problem when I try print a document from a normal user (no work station administrator) the user can't print the report, but when I try print from a administrator I can't print the report without problems.

thanks and greetings.

HI,

I am not sure about this "can't print the report without problems.". Do you mean you also meet some problems when you act as a administrator? If so , What is the exact error or problems you have when you try to print it.

I hope the above information will be helpful. If you have any issues or concerns, please let me know. It's my pleasure to be of assistance

|||

Hi,

I review and the cause of problem they were the permissions of the user over his machine, I give administrator permisions and there is no more the problem, I try found exactly the reason.

greetings.

sql

Problem print report from vb app

we have a vb app that displays reports yet when you try and print the report it either doesn't do so (although it appears to queue it) or it prints but with info missing and control info in odd spots. Anyone have any clues as to how to resolve this? My reports do me no good if the developers can't make the apps access them via the applications they are developing.Do you use Report Viewer control to display reports?

Wednesday, March 21, 2012

Problem Plz Help

I have made a report with 2 parameters.

Parameters are

1. Compay_ID Integer

2. Resource ID Integer

There parameters are automatically added because i am using a stored procedure that have these 2 parameters.

When i call the report and give it parameter having values 1 ,1 . page give me error

The value of parameter 'Parameters' is not valid. Check the documentation for information about valid values. --> The value of parameter 'Parameters' is not valid. Check the documentation for information about valid values.

Description:An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details:System.Web.Services.Protocols.SoapException: The value of parameter 'Parameters' is not valid. Check the documentation for information about valid values. --> The value of parameter 'Parameters' is not valid. Check the documentation for information about valid values.

I am very much worried about it and unable to understand what is the problem .

I am new to these reporting services and dont know so much about it

PLz help

Thanks

Hi,
I think that the problem is the Parameters' name.
You can check their exact name in Report Parameters (Name that's the name of the parameter expected by store proc).|||plus. you might also want to change the datatype of the parameters to integer. You can do this from Report -> Parameters
|||Well, just by looking at the exception handlers there are two things I would consider!
It is not necessary to define the parameter from Reporting Services "parameters" as an integer. Just define it as a string... I am not even sure why an Integer Parameter type was defined within MSRS - maybe the developers have an answer. All keys in my database are integers - but I never pass an Integer Parm.
CREATE PROCEDURE ????(Whatever) @.Parm_Allergic_Group nvarchar(5) as

-- SETUP RUNTIME OPTIONS / DECLARE VARIABLES --
set nocount on
Just make sure you define the parameter list within the stored procedure in the sequence you provide the parameter selections within Reporting Services.....
If you have a "string" passed from reporting services and you use to compare against an "Integer" key - you wil get a hit - so once again - just define as a string and make sure the syntax on the Create Procedure is correct with the expected variables.
# 2:
So are you displaying the available selection list within MS RS from a query - then the user selects a parameter from the selection list --- If so, if you define as a "string" there should be no problems!
# 3
Can you execute the SQL from the data set you defined within MS RS - create a TEST application within MS RS copy the SQL from the stored procedure - paste into a data set within the TEST application and see if it runs! If you run from reporting services the parameter list will present itself and - you as a user cannot enter "INTEGER" characters - so why define the "integers" Notice Integer CHARACTERS - Integer are not Characters!!!!
I have discovered that it is just best to define your parameters as "strings" and then everything will work as planned.
Best regrads.
Joe Harris

Problem Passing Report Parameters in URL

I'm currently trying to create a report that will take three parameters in the URL to generate a report: year, month, and day. The report is using an analysis services data source in RS 2005. Now, my problem is that the parameters being passed in the URL are not being selected in the drop down boxes for the parameters. The report does not throw any exceptions, and after the user selects values for the year, month, and day everything generates successfully.

Here is the URL format I am trying: http://localhost/ReportServer?/FolderName/ReportName&rs:Command=render&Year=2006&Month=6&Day=9

Currently, my parameters are all set to null for default values. They are also not multivalued, not internal, not hidden, don't allow blank, and don't allow null. I have also looked through the valid values in the drop down box for each parameter and verified that the values I supplied in the URL do exist. Also, the data types for each parameter is Integer just like the data type found in the database.

In my opinion, this problem seems directly related to using an analysis services data source. After I was getting this problem, I created a sample report using SQL Server data source, used the same three parameters, and passed them in the URL. Everything on that report worked perfectly.

Please help, I've looked thorugh almost every piece of documentation regarding parameters for Reporting Services and still no luck. Thanks!!

Are you sure those are the names of the parameters and not the prompts?

You can view the parameter names in Report Manager.

|||These are the correct names of the parameters. The prompt names match the actual parameter names.|||

Can you post the portion of the RDL which defines the parameters?

Also make sure that the value you are assigning is really a proper value, and not the label for a proper value.

|||

Actually, I just figured out the problem...

When you are working with an analysis services data source, the parameter values are different from the values listed in the database.

For example, suppose you need the parameter CalendarYear. In the database the values are 2004, 2005, 2006, etc... However, in reporting services the parameter values are actually [DimensionName].[FieldName].&[value] ... or ..... [Date Dim].[CalendarYear].&[2006]

In case you are ever unclear of a parameter value for something, just go to the "Data" tab, click the Dataset for the parameter, ie. "CalendarYear". Then click out of the Design View. Finally, click the execute query button and observe the values listed in the parameter value column. These are the list of valid values which can be used.

As a side note, when adding these parameter values in a URL, you will need to escape the ampersand character in the value expression otherwise it won't work. For example, CalendarYear=[Date Dim].[CalendarYear].%26[2006]

I hope this helps everyone. I know I spent a lot of time working on this.

Thanks!!

|||i am not sure about the answer given above as the correct date time format to acess in url is

Code Snippet
YYYY-MM-DDTHH:MM:SS

And the report that is created above is defalut to query type that should not be right

bye
arya|||

I'm experiencing a similar problem, with a special character in the FieldName part of the parameter:

Someting like:

CalendarYear=[Date Dim].[Calendar ?Year].%26[2006]

I've already tried escaping the ? and characters:

CalendarYear=[Date Dim].[Calendar %abYear%bb].%26[2006]

Any ideas ?