Re: Q: loading Crystal report 10 from file
- From: "Bruce Wood" <brucewood@xxxxxxxxxx>
- Date: 20 Mar 2006 00:26:00 -0800
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);
.
- References:
- Q: loading Crystal report 10 from file
- From: dllhell
- Q: loading Crystal report 10 from file
- Prev by Date: Having problem with class decaration when Building a class libraray
- Next by Date: Thread.Sleep vs Thread.Join
- Previous by thread: Q: loading Crystal report 10 from file
- Next by thread: Question about casting
- Index(es):
Relevant Pages
|