Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
DB Engine
SQL ServerMSDESQL Server CE
Services
Analysis (Data Mining)Analysis (OLAP)DTSIntegration ServicesNotification ServicesReporting Services
Programming
CLRConnectivitySQLXML
Other Technologies
ClusteringEnglish QueryFull-Text SearchReplicationService Broker
General
Data WarehousingPerformanceSecuritySetupSQL Server ToolsOther SQL Server Topics
DirectoryUser Groups
Related Topics
MS AccessOther DB ProductsMS Server Products.NET DevelopmentVB DevelopmentJava DevelopmentMore Topics ...

SQL Server Forum / Services / Reporting Services / July 2008

Tip: Looking for answers? Try searching our database.

SSRS and c# local report

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Michael Kugler - 08 Jul 2008 10:37 GMT
Hi,

I want to use the Reportingservices to create a PDF out of my web
application. I don't want to show it in the Report viewer. It should be just
downloadable.
The Report should be created localy without using the webservice of the
reporting services.

i've seen lots of samples and tried do get the thing to work but it
doesn't...

(in the Report Designer everything looks good and works fine)

here ist my last try of getting the report to work:

sing System;

using System.Collections.Generic;

using System.Text;

using System.Web;

using Microsoft.Reporting.WebForms;

using System.Diagnostics;

using System.Data;

namespace Intranet.Reports

{

public class ssrsReports

{

public void test(HttpResponse MyResponse)

{

Microsoft.Reporting.WebForms.LocalReport lr = new
Microsoft.Reporting.WebForms.LocalReport();

DataSet mydataset = new DataSet();

//repView.LocalReport.ReportPath = "C:\\ssrs_test\\Test\\Test";

lr.ReportPath = @":\mk_work\Experimental\ssrs_test\Test\Test\report2.rdl";

//lr.DataSources.Add(new ReportDataSource("DataSource1", mydataset));

//repView.LocalReport.ReportEmbeddedResource =
"C:\\ssrs_test\\Test\\Test\\report2.rdlc";

//ReportDataSource reportDataSource = new ReportDataSource(dataSetName + "_"
+ dataTableName, dsReport.Tables[0]);

//repView.LocalReport.DataSources.Add(reportDataSource);

//Show();

Warning[] warnings;

string[] streamids;

string mimeType;

string encoding;

string extension = "";

try

{

byte[] bytes = lr.Render("PDF", null, out mimeType, out encoding, out
extension, out streamids, out warnings);

MyResponse.Clear();

MyResponse.ContentType = "application/pdf";

MyResponse.AddHeader("Content-disposition", "filename=output.pdf");

MyResponse.OutputStream.Write(bytes, 0, bytes.Length);

MyResponse.OutputStream.Flush();

MyResponse.OutputStream.Close();

MyResponse.Flush();

MyResponse.Close();

}

catch (Exception e)

{

Exception inner = e.InnerException;

while (inner != null)

{

Debug.Print(inner.Message);

inner = inner.InnerException;

}

}

}

}

}

any ideas?

Regards,

Michael
Norman Yuan - 08 Jul 2008 18:18 GMT
Since you use "LocalReport", so, it has nothing to do with SSRS. Your
problem is that your code try to open a "*.rdl" as local report. *.rdl
report is designed for Reporting Services, not local report. You need to
design a local report, not using SSRS report designed, but using VS2005/8's
built-in report designer. That is, in the project, select "Add new Item..."
and tehn select Report, which is in *.rdlc format.

> Hi,
>
[quoted text clipped - 122 lines]
>
> Michael
Michael Kugler - 10 Jul 2008 07:28 GMT
Hi Norman,

that was exactly my fault... now it is running

Thanks.

Michael
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.