473,626 Members | 3,340 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

VS.Net 8 & Crystal Report question

Hi
I am working on a C# Windows Application that builds an invoice (CR)
converts to PDF and attach to email one at a time.

This works untill my invoice count get over 40 to 50 invoices then I start
getting errors. The errors vairy. sometimes IO sometime "unable to load
report".

Has anyone here had a need to creat reports in mass?

Code:Example
// before the Form InitializeCompo nent
ReportDocument r = new ReportDocument( );
//
// Get Invoice Emailing Data
DataSet ds = DataCalls.getIn voiceEmailList( val1, val2);
int rowcount = 0;
foreach (DataRow dr in dt.Rows)
{
BuildInvoiceRep ort(ds.Tables[0].Rows[rowcount][0].ToString(),
ds.Tables[0].Rows[rowcount][1].ToString()ds.T ables[0].Rows[rowcount][2].ToString()ds.T ables[0].Rows[rowcount][3].ToString());
EmailPDF();
}
//Get invoice data and build Report one at a time
private void BuildInvoiceRep ort(int CommodityID, int InvoiceNumber, string
OrderBy)
{
DataSet ds = DataCalls.getIn voiceDataSet(Co mmodityID, InvoiceNumber,
InvoiceNumber, OrderBy, 0);
r = null;
r = new Invoice();
r.SetDataSource (ds);
r.SetParameterV alue(0, OrderBy);
r.SetParameterV alue(1, comboBox.Select edValue.ToStrin g());
}
// email invoice
private void EmailPDF(int InvoiceNumber)
{
string ExportPath;
string emailFrom;
string subject;
string fName;
ExportPath = Application.Sta rtupPath.ToStri ng();
fName = ExportPath + "\\Invoice" + InvoiceNumber + ".pdf";
r.ExportToDisk( ExportFormatTyp e.PortableDocFo rmat, fName);
emailFrom = "em**********@h ere.com";
subject = "Invoice#: " + InvoiceNumber + ".pdf";
emailTo = "em**********@t here.com";

SmtpClient smtpclient = new SmtpClient();
MailMessage mailmsg = new MailMessage();
smtpclient.Host = ConfigurationMa nager.AppSettin gs["MailServer "];
MailAddress fromaddress = new MailAddress(ema ilFrom);
mailmsg.From = fromaddress;
mailmsg.To.Add( emailTo);
mailmsg.Subject = subject;
mailmsg.Body = body;
mailmsg.Attachm ents.Add(new Attachment(atta chmentFilePath) );
smtpclient.Send (mailmsg);
//Dispose attachment object so that file can get deleted
mailmsg.Attachm ents.Dispose();
File.Delete(att achmentFilePath );
}

Thanks for any help

Brian
Jul 12 '06 #1
4 1708

BrianDH wrote:
Hi
I am working on a C# Windows Application that builds an invoice (CR)
converts to PDF and attach to email one at a time.

This works untill my invoice count get over 40 to 50 invoices then I start
getting errors. The errors vairy. sometimes IO sometime "unable to load
report".

Has anyone here had a need to creat reports in mass?
I didn't study your code too closely, but from what I saw it looks
fine. We are using CR to produce mass reports here, too, using the same
"push" model that you appear to be using. I've produced reports
containing upwards to 180 pages of purchase orders with no problems at
all.

Crystal can be flakey, but in my experience it's usually me
misinterpreting the (terrible) MSDN documentation for CR more than
anything else.

Exactly where does the error occur, when it occurs?

Jul 12 '06 #2
Hi

The reports themselves are never more than a few pages. Its just we create
one after the other and email and delete as we go. Sometimes there will be
over 200 different invoices (CR) created and Emailed.

I get errors sometimes at the:
r.SetDataSource (ds);
also at the: mailmsg.Attachm ents.Add(new Attachment(atta chmentFilePath) );

CR flakey is an understatment.

Thanks
B


"Bruce Wood" wrote:
>
BrianDH wrote:
Hi
I am working on a C# Windows Application that builds an invoice (CR)
converts to PDF and attach to email one at a time.

This works untill my invoice count get over 40 to 50 invoices then I start
getting errors. The errors vairy. sometimes IO sometime "unable to load
report".

Has anyone here had a need to creat reports in mass?

I didn't study your code too closely, but from what I saw it looks
fine. We are using CR to produce mass reports here, too, using the same
"push" model that you appear to be using. I've produced reports
containing upwards to 180 pages of purchase orders with no problems at
all.

Crystal can be flakey, but in my experience it's usually me
misinterpreting the (terrible) MSDN documentation for CR more than
anything else.

Exactly where does the error occur, when it occurs?

Jul 12 '06 #3

BrianDH wrote:
Hi

The reports themselves are never more than a few pages. Its just we create
one after the other and email and delete as we go. Sometimes there will be
over 200 different invoices (CR) created and Emailed.

I get errors sometimes at the:
r.SetDataSource (ds);
also at the: mailmsg.Attachm ents.Add(new Attachment(atta chmentFilePath) );
Can you post the exact text of the errors (including the stack dump)
and indicate where in your code each of them occurs? One sounds like an
SMTP error, while the other sounds like Crystal getting pissy about
something.

By the way, how did you design your reports? Did you export your
DataSet to an XSD and use that as the basis for your report design? If
so, is your .rpt up to date with the latest XSD? One problem I've come
across frequently is that the data in the DataSet doesn't exactly match
the schema I used to produce the report template. If that happens, then
the reporting dies "sometimes" whenever the data for a particular
report doesn't match the schema, but works other times whenever the
offending data items are absent.

If you haven't already, try using .WriteXmlSchema on the DataSet to get
an XSD out and then use Crystal's "Verify Database" command to update
the .rpt to the exported schema.
CR flakey is an understatment.
Oh, it's not that bad. It's no worse than Win32 programming used to be:
bad documentation, learning by experimentation and folklore, things
fall over occasionally. That sort of thing.

Jul 12 '06 #4
Hi Bruce

OK, the SMTP error is 'caused by bad formating in email address. I have
fixed that with addtional validation on the client.

The CR was due to the fact they they were depending on "r = null" to clear
memory when there was also needed " r.close()" first. I found about 3 gig's
of temp.rpt files in the temp dir on the accounting box.

Anyway, the problem seems to be fixed.

Thanks for the help, I was stressing.

Brian

"Bruce Wood" wrote:
>
BrianDH wrote:
Hi

The reports themselves are never more than a few pages. Its just we create
one after the other and email and delete as we go. Sometimes there will be
over 200 different invoices (CR) created and Emailed.

I get errors sometimes at the:
r.SetDataSource (ds);
also at the: mailmsg.Attachm ents.Add(new Attachment(atta chmentFilePath) );

Can you post the exact text of the errors (including the stack dump)
and indicate where in your code each of them occurs? One sounds like an
SMTP error, while the other sounds like Crystal getting pissy about
something.

By the way, how did you design your reports? Did you export your
DataSet to an XSD and use that as the basis for your report design? If
so, is your .rpt up to date with the latest XSD? One problem I've come
across frequently is that the data in the DataSet doesn't exactly match
the schema I used to produce the report template. If that happens, then
the reporting dies "sometimes" whenever the data for a particular
report doesn't match the schema, but works other times whenever the
offending data items are absent.

If you haven't already, try using .WriteXmlSchema on the DataSet to get
an XSD out and then use Crystal's "Verify Database" command to update
the .rpt to the exported schema.
CR flakey is an understatment.

Oh, it's not that bad. It's no worse than Win32 programming used to be:
bad documentation, learning by experimentation and folklore, things
fall over occasionally. That sort of thing.

Jul 12 '06 #5

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

Similar topics

1
19158
by: Stephan | last post by:
Hi, I'm using Visual Studio 2003 (C#) with the integrated Crystal Report software and have the following question: How can I assign a value (string) to an unbound (string) field in Crystal Report at runtime? Example: private void button1_Click(object sender,
1
1370
by: Bari Allen | last post by:
First I'm an almost complete newbie at .NET, as I've only taken some classes, worked through a beginner-level book, and done one minor console application on my own. That being said, I followed a method from Sybex's "Mastering Crystal Reports 9" to import a version 10 Crystal Report into a Windows Form, using Visual Studio.NET Following the instructions, I then dropped a ReportDocument object onto the form & linked it to the report. ...
2
4825
by: Dougie | last post by:
I am obtaining a DataSet from an XML web service. It contains a number of ten pin bowling scores from 4 different players. I want to provide a means of graphing the performance of the round and comparing each player against the rest. I've looked into Crystal Reports, but I'm not well up on how they work. Can anyone suggest a way of analysing these scores? Doug.
19
3868
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 ReuseParameterValuesOnRefresh="True" in a viewer, but it still doesn't work. Did anyone run into this problem. What's the solution? Please help. Thank you
0
1221
by: John Kastrinos | last post by:
Yes, I know this is more of a Crystal group question. I posted there about 2 weeks ago, but no one EVER replies over there. So, I thought I would take a shot here. If anyone has heard of this, please let me know: I have a VB.NET NT service that: creates a Crystal report object, loads report, connects report to Informix database, and exports the report to PDF. Service runs great for days, exporting hundreds of times without problem....
3
1847
by: Trichy | last post by:
Hi Can any one help me. I added crystal report item to my project .net. After connecting to database , i inserted three columns from table. I ran report in ..net is working fine. My problem, I want to add fouth column from DB to my report. My field viewer is disable, I cann't insert columns from table. Can any one help me to enable field viewer in tool bar.
1
1898
by: riyaz | last post by:
i am new to .net environment, anyone can advise me how to create a crystal report ,how to connect to databse and to display in web page .As i m developing asp.net based web application i want to put the report in web. plz adcise me regards
0
2502
by: YellowFin Announcements | last post by:
Introduction Usability and relevance have been identified as the major factors preventing mass adoption of Business Intelligence applications. What we have today are traditional BI tools that don't work nearly as well as they should, even for analysts and power users. The reason they haven't reached the masses is because most of the tools are so difficult to use and reveal so little
0
2329
by: Mark Gold | last post by:
Hi! We have a VB application using Crystal Reports 6 that has worked successfully on hundreds of systems for over 10 years. Now, on one network, the application and access database does not close. It seems to hang on the command. When we open the application an peruse the screens without opening up a report (using crystal reports), the application and access db closes fine. But as soon as we run a report and then close the report and...
0
8266
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8199
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8705
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8638
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8365
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7196
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6125
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4198
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1511
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.