473,397 Members | 1,950 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

SSRS/c# Problem

Hi,

I've got some problems using the reporting services from c#. I want to
include a pdf export in my web application..

I've already tried different samples and code snippets but I don't get it to
work. (I don't want to use the web service to get the report from.)

Here is my code. The following internal error occurs: The report definition
for report 'C:\ssrs_test\Test\Test\report2.rdl' has not been specified

is it possibly the data source? Is it necessary to add a data source even if
I have it already set while creating the report?

public void test(HttpResponse MyResponse)
{
Microsoft.Reporting.WebForms.ReportViewer repView = new
Microsoft.Reporting.WebForms.ReportViewer();

LocalReport lr = repView.LocalReport;

repView.Reset();
repView.LocalReport.ReportPath = "C:\\ssrs_test\\Test\\Test";
repView.LocalReport.ReportEmbeddedResource =
"C:\\ssrs_test\\Test\\Test\\report2.rdlc";
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;
}

}
Schöne Grüße

Michael Kugler
Jul 7 '08 #1
2 3924
On Jul 7, 12:22*pm, "Michael Kugler" <kugle...@gmx.dewrote:
Hi,

I've got some problems using the reporting services from c#. *I want to
include a pdf export in my web application..

I've already tried different samples and code snippets but I don't get itto
work. (I don't want to use the web service to get the report from.)

Here is my code. *The following internal error occurs: The report definition
for report 'C:\ssrs_test\Test\Test\report2.rdl' has not been specified

is it possibly the data source? Is it necessary to add a data source evenif
I have it already set while creating the report?

public void test(HttpResponse MyResponse)
{
Microsoft.Reporting.WebForms.ReportViewer repView = new
Microsoft.Reporting.WebForms.ReportViewer();

LocalReport lr = repView.LocalReport;

repView.Reset();
repView.LocalReport.ReportPath = "C:\\ssrs_test\\Test\\Test";
repView.LocalReport.ReportEmbeddedResource =
"C:\\ssrs_test\\Test\\Test\\report2.rdlc";
I'm not a Crystal Reports expert, but why do you set both ReportPath
and ReportEmbeddedResource? MSDN docs on either clearly specify that
when one property is set, the value of the other is ignored. Since
ReportEmbeddedResource is the one you set last, then it looks like
it's the one that's actually used.

In any case, ReportPath should be the path to the file with the
report, and not a directory; and ReportEmbeddedResource should only be
used to load reports that are embedded into an assembly (as the name
clearly indicates), and cannot be a filesystem path.

Try doing this instead of your two lines for ReportPath &
ReportEmbeddedResource:

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

And see if that works.
Jul 7 '08 #2
Hi Pavel,

i've tested your advice but it still doesn't work.
now the error message is:
A first chance exception of type
'Microsoft.Reporting.WebForms.MissingReportSourceE xception' occurred in
Microsoft.ReportViewer.WebForms.dll

Regards,

Michael
Jul 8 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Max2006 | last post by:
Hi, I am developing a web application on windows XP. A page within my application needs to access to SSRS running on the same machine. Once the web application tries to consume the SSRS web...
0
by: Wes Groleau | last post by:
Is there a reasonably simple way to dump an SSRS report into Excel format automatically at a scheduled time without using Report Manager/Report Server? Creating the report was easy, but we seem...
1
by: Jason1983 | last post by:
I have SSRS deployed on a machine. My problem is whenever I create a new SSRS report project in Visual Studio .NET, I have to change the "TargetServerURL" name in the project properties to reflect...
0
by: Aswanth | last post by:
I'm Working with Asp.Net with C#.. & I'm Generating Reports in SSRS-2005.. Till Now I'm Generating Reports in SSRS-2005 with Stored Procedure.. in Which I'm Generating Reports for One...
0
by: Aswanth | last post by:
I'm Using Asp.Net with C# & SSRS 2005 for Generating Reports.. I'm Having HUGE Data in Text Log File.. I want to Get this Data from this Log File & to Generate REPORTS in SSRS 2005.. Please...
1
by: Aswanth | last post by:
I'm Using Asp.Net with C# & SSRS 2005 for Generating Reports.. I'm Having HUGE Data in Microsoft Excel Sheets .. I want to Get this Data from this Microsoft Excel Sheets & to Generate REPORTS in...
0
by: kuper | last post by:
Hi i have some reports developed in SSRS 2008. I like to display them on my WPF. Please suggest me what are the options i have is their any in built sopprt for SSRS? I am not very keen to...
0
by: S_K | last post by:
Hi, I have a problem in which we need a ton of reports running against an AX system and we need allot of people building reports using SSRS (sorry Report Builder won't work for us). The problem...
0
by: fresher1 | last post by:
Hi i want to learn about the ssis n ssrs packages can u please send me the best links regarding ssis and ssrs. thanku
0
by: napstar | last post by:
I have a multi value Country parameter in SSRS which is populated by an Oracle dataset.There is also a province parameter which is populated based on the Country selected by the user. These...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.