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

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 InitializeComponent
ReportDocument r = new ReportDocument();
//
// Get Invoice Emailing Data
DataSet ds = DataCalls.getInvoiceEmailList(val1, val2);
int rowcount = 0;
foreach (DataRow dr in dt.Rows)
{
BuildInvoiceReport(ds.Tables[0].Rows[rowcount][0].ToString(),
ds.Tables[0].Rows[rowcount][1].ToString()ds.Tables[0].Rows[rowcount][2].ToString()ds.Tables[0].Rows[rowcount][3].ToString());
EmailPDF();
}
//Get invoice data and build Report one at a time
private void BuildInvoiceReport(int CommodityID, int InvoiceNumber, string
OrderBy)
{
DataSet ds = DataCalls.getInvoiceDataSet(CommodityID, InvoiceNumber,
InvoiceNumber, OrderBy, 0);
r = null;
r = new Invoice();
r.SetDataSource(ds);
r.SetParameterValue(0, OrderBy);
r.SetParameterValue(1, comboBox.SelectedValue.ToString());
}
// email invoice
private void EmailPDF(int InvoiceNumber)
{
string ExportPath;
string emailFrom;
string subject;
string fName;
ExportPath = Application.StartupPath.ToString();
fName = ExportPath + "\\Invoice" + InvoiceNumber + ".pdf";
r.ExportToDisk(ExportFormatType.PortableDocFormat, fName);
emailFrom = "em**********@here.com";
subject = "Invoice#: " + InvoiceNumber + ".pdf";
emailTo = "em**********@there.com";

SmtpClient smtpclient = new SmtpClient();
MailMessage mailmsg = new MailMessage();
smtpclient.Host = ConfigurationManager.AppSettings["MailServer"];
MailAddress fromaddress = new MailAddress(emailFrom);
mailmsg.From = fromaddress;
mailmsg.To.Add(emailTo);
mailmsg.Subject = subject;
mailmsg.Body = body;
mailmsg.Attachments.Add(new Attachment(attachmentFilePath));
smtpclient.Send(mailmsg);
//Dispose attachment object so that file can get deleted
mailmsg.Attachments.Dispose();
File.Delete(attachmentFilePath);
}

Thanks for any help

Brian
Jul 12 '06 #1
4 1694

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.Attachments.Add(new Attachment(attachmentFilePath));

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.Attachments.Add(new Attachment(attachmentFilePath));
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.Attachments.Add(new Attachment(attachmentFilePath));

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
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...
1
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...
2
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...
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: 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,...
3
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, ...
1
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...
0
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...
0
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....
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
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:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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: 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...

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.