473,387 Members | 1,664 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,387 software developers and data experts.

Q: loading Crystal report 10 from file

hello all,

this is my code:

LINE_1: CrystalDecisions.CrystalReports.Engine.ReportDocum ent aRep= new
CrystalDecisions.CrystalReports.Engine.ReportDocum ent();

LINE_2: aRep.Load("c:\rep1.rpt", OpenReportMethod.OpenReportByTempCopy);

in line_2 whatever option I use in load method error occured {"Load report
failed."}, also I have tryed with "\\c:\rep1.rpt"...

As you can see, I'm newone in c# programming so please be patient with me :)

thanks for help in advance

Mar 20 '06 #1
2 1903
There is only one thing I can see that's wrong, and it's subtle.

A backslash in C# string tells the compiler to interpret the following
character as special. So, when you wrote:

"c:\rep1.rpt"

what the compiler saw was [c] [:] [carriage return] [e] [p] [1] [.] [r]
[p] [t]. So what's that carriage return doing there? Well, it's what
"\r" stands for. In order to get a backslash in a C# string you have to
do one of two things. Either write

"c:\\rep1.rpt" which works because a double backslash in a normal
string resolves to a single backslash (i.e.: "Treat the next character
as special: it's a real backslash."), or

@"c:\rep1.rpt" which works because the @ preceding the opening quote
tells the compiler, "There are no special characters in this string;
treat every character exactly as shown."

So, you should write either:

aRep.Load("c:\\rep1.rpt", OpenReportMethod.OpenReportByTempCopy);

or

aRep.Load(@"c:\rep1.rpt", OpenReportMethod.OpenReportByTempCopy);

Mar 20 '06 #2

"Bruce Wood" <br*******@canada.com> wrote in message
news:11**********************@g10g2000cwb.googlegr oups.com...
aRep.Load(@"c:\rep1.rpt", OpenReportMethod.OpenReportByTempCopy);

thank you dear sir!
Mar 20 '06 #3

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

Similar topics

0
by: habdalla | last post by:
When loading crystal reports in my windows applications(created using Visual C#), I get an error "Buffer too small for string or missing null byte". I tried various things i.e. increasing the...
2
by: Mythran | last post by:
In .Net, how can I go about and set a Crystal Reports namespace? Right now they use the Root Namespace (VB) from the project. How can I extend the namespace for a single report (which will be set...
1
by: Karthic | last post by:
When i right click on the .rpt file in the VS 2003, i see a property printer setting. It says "No printer" on the top and there is option to select printer and paper settings etc.. I want to...
0
by: BATISTA | last post by:
Hi , I am working in c# with crystal report XI. I read an example about dynamic image location .. 1) In that we have a xml xchema file with two fields n amed country--datatype is string,...
19
by: LP | last post by:
I am using (trying to) CR version XI, cascading parameters feature works it asks user to enter params. But if page is resubmitted. It prompts for params again. I did set...
0
by: Chris | last post by:
I have the following situation in a VB.Net App I am working on: 1.)A report created in VS.Net 2003 using the CR.Net component of VS 2003. 2.)The datasource for the report is a Stored Proc in a...
0
by: Jeff | last post by:
Help!!! The bitmap I am trying to display in a sample Crystal Report is coming up with much less quality than the original bitmap. I have a 300x300 dpi bitmap file that I want to insert at run...
0
by: PGIslander | last post by:
I building a windows application with VB.net using VS.net 2003 & Crystal Report 9. Created .rpt file & run on crystal viewer form. At the PC with VS.net & CR installed, no problem to run the...
11
by: =?Utf-8?B?cmtibmFpcg==?= | last post by:
How can I stop receiving this message while calling a crystal report? "The report you requested requires further information." Thanks
1
by: Tomizechsterson | last post by:
I have an app, that when it calls ReportDocument.Load(filename), it throws an Exception that just says "Load report failed." Upon further investigation, the ErrorCode is -2147483136, the...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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...

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.