[Webinar] Streamline your web hosting managementRegister Today

x
?
Solved

Open SQL PDF Report in PDF not Report Viewer

Posted on 2010-04-08
3
Medium Priority
?
277 Views
Last Modified: 2012-05-09
Hello,

I am trying to open a SQL Report in a pdf instead of the report view when i click on a link on my site, which is written in C#.  You can see below the code that I have that says open the url I give it in another window.  Currently when I click the link the report will open in the SQL report wizard, but I want it to go stright to pdf like in the second image.  is there something that i need to put in the URL for this to happen or what?
Response.Write("<script>window.open('" + url + "');</script>");

Open in new window

img1.JPG
img2.JPG
0
Comment
Question by:DB_Fury
3 Comments
 
LVL 9

Expert Comment

by:rg20
ID: 30114781
why not

Response.Write("<a href=('" + url + "')> PDF Version</a>");
0
 
LVL 16

Accepted Solution

by:
Megan Brooks earned 2000 total points
ID: 30118989
Is the URL you are opening a Report Server URL? If so, you can add the query parameter rs:Format=PDF to request that the report be rendered in PDF format. See the example below. When I go to this (intranet) URL, it brings up the dialog shown in your second image.

I haven't actually tried this but another approach might be to use the ServerReport.Render method of the ReportViewer control. It can render a report in PDF format and return it as a Stream that you can use however you need to.

http://web2/CPCARS10/Pages/ReportViewer.aspx?%2fCPCA+Shared%2fAdmin%2fAdmin+-+Website+Accounts&rs:Command=Render&rs:Format=PDF

Open in new window

0
 
LVL 1

Author Closing Comment

by:DB_Fury
ID: 31712289
Thats exactly what i was looking for!! thank you
0

Featured Post

[Webinar] Improve your customer journey

A positive customer journey is important in attracting and retaining business. To improve this experience, you can use Google Maps APIs to increase checkout conversions, boost user engagement, and optimize order fulfillment. Learn how in this webinar presented by Dito.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
SQL Database Recovery Software repairs the MDF & NDF Files, corrupted due to hardware related issues or software related errors. Provides preview of recovered database objects and allows saving in either MSSQL, CSV, HTML or XLS format. Ensures recov…
Stellar Phoenix SQL Database Repair software easily fixes the suspect mode issue of SQL Server database. It is a simple process to bring the database from suspect mode to normal mode. Check out the video and fix the SQL database suspect mode problem.

591 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question