Email Crystal Reports from C# Application
The following program describes how to email a Crystal Reports from C# .
All C# Crystal Reports Tutorial in this website is based on the following database - crystaldb. So before you begin this section , please take a look at the database structure of crystaldb - Click Here C# crystaldb
If you are new to Crystal Reports and do not know how to create Crystal Reports from C# , please take a look at the section step by step tutorial for creating a Crystal Reports from C#.
For email a Crystal Report from C# first we have to export the Crystal Reports in any of the File Format available in Crystal Reports and then Email it.
In this section we use the previous tutorial C# Crystal Reports Export to PDF file . So before we start this section please take a look at the tutorial C# Crystal Reports Export to PDF file.
Once you have successfully exported the Crystal Reports as a PDF file format and saved it to your disk, the subsequent step involves sending that particular file via email. To accomplish this, we can rely on the System.Web.Mail library available in C#. It is essential to provide the requisite information for configuring the SmtpMail client, allowing us to transmit the exported file as an attachment.
To proceed, select the default form (Form1.cs) you created in C# and proceed to add two buttons (Button1 and Button2) along with a CrystalReportViewer control to your form.
You have to include CrystalDecisions.CrystalReports.Engine in your C# Source Code.
Copy and paste the following source code and run your C# project.
Full Source C#cryRpt.Load(PUT CRYSTAL REPORT PATH HERE\\CrystalReport1.rpt");
The Crystal Reports file path in your C# project files location, there you can see CrystalReport1.rpt . So give the full path name of Crystal Reports file like c:\projects\crystalreports\CrystalReport1.rpt
Before you run this program , you have to provide the necessary SMTP information , that is your HOSTNAME , FROM ADDRESS and TO ADDRESS to the SMTP client.
- C# Crystal Reports sample databse
- C# Crystal Reports step by step
- C# Crystal Reports from multiple tables
- C# Crystal Reports String parameter
- C# Crystal Reports Integer parameter
- C# Crystal Reports Date parameter
- C# Crystal Reports Dynamic Logon parameters
- C# Crystal Reports Formula Field
- C# Crystal Reports Summary Field
- C# Crystal Reports Export to Pdf
- C# Crystal Reports Export to Excel
- C# Crystal Reports without database
- C# Crystal Reports from SQL Query
- Dynamic Crystal Reports from C# Application
- C# Crystal Reports from XML
- C# Crystal Reports - sub reports
- C# Crystal Reports - on demand sub reports
- C# Crystal Reports - Date to Date
- How to print Crystal Reports in C#
- How to deploy Crystal Report
- How to Crystal Report Merge Module