Showing posts with label executes. Show all posts
Showing posts with label executes. Show all posts

Friday, March 23, 2012

Report Viewer Control - Export to PDF, Works on local IIS computer, but not another.

When exporting a report to a pdf file, I am experiencing what seems to be a "hang up" on the server. The code executes fine from my development machine, but when moved to the server I get this response. I also recieve this message if I click the refresh button. Acrobat could not open 'pdf9c9.tmp' because it is either not a supported file type or because the file has been damaged (for example, it was sent as an email attachment and wasn't correctly decode). To create an Adobe PDF document, go to the source application. Then print the document to Adobe PDF.

Here is my code for reference. It works fine on one IIS, but not another. What could I be missing?

Dim warningsAs Microsoft.Reporting.WebForms.Warning() =Nothing

Dim streamidsAsString() =Nothing

Dim mimeTypeAsString =Nothing

Dim encodingAsString =Nothing

Dim extensionAsString =Nothing

Dim deviceInfoAsString

Dim bytesAsByte()

Dim lrAsNew Microsoft.Reporting.WebForms.LocalReport

lr.ReportPath ="Report1.rdlc"

'lr.DataSources.Add(New Microsoft.Reporting.WebForms.ReportDataSource("DischargeSummary", ObjectDataSource1()))

deviceInfo ="<DeviceInfo><SimplePageHeaders>True</SimplePageHeaders></DeviceInfo>"

bytes = ReportViewer1.LocalReport.Render("PDF", deviceInfo, mimeType, encoding, extension, streamids, warnings)

Response.ClearContent()

Response.ClearHeaders()

Response.ContentType ="application/pdf"

Response.BinaryWrite(bytes)

Response.Flush()

Response.Close()

Check security permission on the server.

Wednesday, March 21, 2012

Report timeout after 60 minutes

I'm running a long report from Reporting Services web site. When I run
the stored procedure by itself, it executes with no problem, taking
about 3 hours to complete. When I execute the report itself, it runs
for exactly 60 minutes and after that I get "The page can not be
displayed" message. I played around with session timeouts and report
execution timeout setting both of these to 5 hours, however that didn't
give any positive results. I'm beginning to think that it maybe some
IIS issue. I also increased the connection timeout in IIS to 5 hours.
Does anyone have any clues?
I'm running this on Windows 2000, IIS 5.
Thank you.
-IKI solved the problem myself. Looks like IE version 5.x and higher,
have 60 minute time-out limit.
A quick registry setting and a restart fixes the problem.
1. Add a ReceiveTimeout DWORD value with a data value of (<number of
seconds>)*1000 in the following registry key:
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet
Settings
For example, if you want the timeout duration to be 8 minutes, set the
ReceiveTimeout data value to 480000 (<480>*1000).
2. Restart your computer.
You can find more info at:
http://support.microsoft.com/kb/q181050/
-IK|||hi IK,
one clarification.
need to set this on the server or on the client.
i am adjusting this setting on a comp connecting to the server and checking
this out.
would be quite a relief to get round this one.
thanks for your note,
SamK
"IK" wrote:
> I solved the problem myself. Looks like IE version 5.x and higher,
> have 60 minute time-out limit.
> A quick registry setting and a restart fixes the problem.
> 1. Add a ReceiveTimeout DWORD value with a data value of (<number of
> seconds>)*1000 in the following registry key:
> HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet
> Settings
> For example, if you want the timeout duration to be 8 minutes, set the
> ReceiveTimeout data value to 480000 (<480>*1000).
> 2. Restart your computer.
>
> You can find more info at:
> http://support.microsoft.com/kb/q181050/
> -IK
>sql

Monday, March 12, 2012

Report Services - capture userid of person running the report

I have a report which executes a stored procedure when the report is opened. What function will capture the identity ( name or user id ) of the person opening the report and therefore executing the procedure?

At what point in the stack are you trying to get the userid? Within the SP, or within the report expressions?

From within the report, you can use User!UserId. If you want to get the login that is currently executing the SP from within the SP, then you can use system_user (http://msdn2.microsoft.com/en-us/library/ms179930.aspx).

|||More specifics please|||

the first parameter of the report is UserId, string, hidden

the available value is label UserId with value =User!UserID. The default value is non-queried =User!UserID

the data source is: exec ReportBase.dbo.proc_TestUser '01/01/2006','01/02/2006',@.UserID

the procedure is:

-- =============================================

-- Create basic stored procedure template

-- =============================================

use ReportBase

GO

-- Drop stored procedure if it already exists

IF EXISTS (

SELECT *

FROM INFORMATION_SCHEMA.ROUTINES

WHERE SPECIFIC_SCHEMA = N'dbo'

AND SPECIFIC_NAME = N'proc_TestUser'

)

DROP PROCEDURE dbo.proc_TestUser

GO

CREATE PROCEDURE dbo.proc_TestUser

@.Date1 as datetime,

@.Date2 as datetime,

@.UserID as varchar(100)

AS

-- drop table ReportBase.dbo.t_UserTest

/*

create table ReportBase.dbo.t_UserTest (

[first_date] [datetime] NULL ,

[second_date] [datetime] NULL ,

[user_name] [varchar](100) NULL )

*/

insert into ReportBase.dbo.t_UserTest

select @.Date1, @.Date2, @.UserID

select * from ReportBase.dbo.t_UserTest

go

Report Services - capture userid of person running the report

I have a report which executes a stored procedure when the report is opened. What function will capture the identity ( name or user id ) of the person opening the report and therefore executing the procedure?

At what point in the stack are you trying to get the userid? Within the SP, or within the report expressions?

From within the report, you can use User!UserId. If you want to get the login that is currently executing the SP from within the SP, then you can use system_user (http://msdn2.microsoft.com/en-us/library/ms179930.aspx).

|||More specifics please|||

the first parameter of the report is UserId, string, hidden

the available value is label UserId with value =User!UserID. The default value is non-queried =User!UserID

the data source is: exec ReportBase.dbo.proc_TestUser '01/01/2006','01/02/2006',@.UserID

the procedure is:

-- =============================================

-- Create basic stored procedure template

-- =============================================

use ReportBase

GO

-- Drop stored procedure if it already exists

IF EXISTS (

SELECT *

FROM INFORMATION_SCHEMA.ROUTINES

WHERE SPECIFIC_SCHEMA = N'dbo'

AND SPECIFIC_NAME = N'proc_TestUser'

)

DROP PROCEDURE dbo.proc_TestUser

GO

CREATE PROCEDURE dbo.proc_TestUser

@.Date1 as datetime,

@.Date2 as datetime,

@.UserID as varchar(100)

AS

-- drop table ReportBase.dbo.t_UserTest

/*

create table ReportBase.dbo.t_UserTest (

[first_date] [datetime] NULL ,

[second_date] [datetime] NULL ,

[user_name] [varchar](100) NULL )

*/

insert into ReportBase.dbo.t_UserTest

select @.Date1, @.Date2, @.UserID

select * from ReportBase.dbo.t_UserTest

go