473,466 Members | 4,850 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

export crystal report to mail

24 New Member
i have to generate bills for the specified candidate

so in order to generate a single person report i wrote the following code



Datatable dt=new Datatable;

DataAdapter da=new DataAdapter();

da.Fill(dt,Gridview.Selectedvalue);

dataset ds=new dataset();

ds.Tables.Add(dt);

ReportDocument rd=new ReportDocument();

rd.Load("CrystalReport.rpt");

rd.SetDatasource(ds);

CrystalReportViewer.Reportsource=rd;

CrystalReportViewer.DataBind();



1.i need to have two bills .how can include another page on the same report.

2. I have written the above code in GridView.SelectedIndexChanged event

now when i select a person profile the corresponding report is generated

now i need to send this in mail as an attachment

how can i do this

when i try to export the report ,the report disappears

what could be wrong

can anyone help me on this regard

Rama
Jul 12 '07 #1
3 4046
dip_developer
648 Recognized Expert Contributor
i have to generate bills for the specified candidate

so in order to generate a single person report i wrote the following code



Datatable dt=new Datatable;

DataAdapter da=new DataAdapter();

da.Fill(dt,Gridview.Selectedvalue);

dataset ds=new dataset();

ds.Tables.Add(dt);

ReportDocument rd=new ReportDocument();

rd.Load("CrystalReport.rpt");

rd.SetDatasource(ds);

CrystalReportViewer.Reportsource=rd;

CrystalReportViewer.DataBind();



1.i need to have two bills .how can include another page on the same report.

2. I have written the above code in GridView.SelectedIndexChanged event

now when i select a person profile the corresponding report is generated

now i need to send this in mail as an attachment

how can i do this

when i try to export the report ,the report disappears

what could be wrong

can anyone help me on this regard

Rama
there is no concept of adding page to a crystal report......
Add another Detail section to your report for the second bill.

secondly, export your report to a format like pdf and attach it to mail....here your concept is right....
but I dont know how your report is disappearing......
Jul 12 '07 #2
radcaesar
759 Recognized Expert Contributor
Hey Export that to PDF and Send it through mail.

Here is the code snippet from VelocityReviews.

'----------- create physical pdf --------

oRpt.ExportToDisk(CrystalDecisions.Shared.ExportFo rmatType.PortableDocFormat,
"C:\XML\" & Trim(Request.QueryString("fn")) & ".pdf")

Response.ClearContent()
Response.ClearHeaders()
Response.ContentType = "application/pdf"
Response.WriteFile(FName)
Response.Flush()
Response.Close()
System.IO.File.Delete(FName)

'------------- send mail begin ---------------
Dim email = New MailMessage
email.BodyFormat = MailFormat.Text
Dim attach = New MailAttachment("C:\XML24\" &
Trim(Request.QueryString("fn")) & ".pdf")


email.From = ""
email.To = ""
email.Subject = "E-MAIL TEST"
email.Body = "This is an e-mail test. Sending e-mail
through asp.net"
email.Attachments.Add(attach)
' Set the SMTP server and send the email
SmtpMail.SmtpServer = "192.168.000.00"
SmtpMail.Send(email)
'------------- send mail end ---------------
Jul 12 '07 #3
rudenaggar
1 New Member
you can send a crystal report by email from just one button click. Please find the following link :

http://csharp.net-informations.com/c...orts-email.htm

ruden.
Apr 17 '13 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Colin Graham | last post by:
Error when attempting to export Crystal Report as PDF document asp.net. I get the following error. Error in File...
6
by: Robin Cushman | last post by:
Hi all, I need some help -- I'm working with an A2K database, using DAO, and am trying to read records into a Crystal Report and then export it to a folder on our network as an Excel...
1
by: John | last post by:
Hi. Sir: Does anyboday know how to export subreport data using the export button in crystal report tool bar? We have a main report including a on-demand report. When we click the on-demand...
0
by: suicidaltendencies | last post by:
I'm able to view the report, but when I click the button on the webpage that shows the report to export into a different format it gives me an error on Export. Any help would be great I keep...
0
by: Leonard Danao | last post by:
Anyone have any ideas as to why this is happenning. There are no other versions of Crystal installed aside from the one that came with vs2003 enterprise. the error happens when the...
0
by: Timmy Jones | last post by:
Hey all, I am trying to try get a crytal report running properly. A "Hello World" report that does not add criteria to the record selection formula of the report (either in the development tool,...
0
by: Henry | last post by:
I have written an ASP/VB.Net application via VS 2003 (Crystal V9) that uses MS Access 2000 as its database. I can export reports that have no linked sub reports for printing. However, I'm unable...
3
by: Brad | last post by:
In a Vista/IIS7 asp.net app, a coded crystal report export is crashing IIS7....but it works just fine in visual studio's cassini web server. And if I create a web form and use the crystal...
0
by: Bill Nguyen | last post by:
I used to be able to have Crystal report send email within a .NET application using "Export" option. Now the option to send mail (Destination MAPI) is no longer available in the Export...
3
by: acextreme | last post by:
Hi all, I have a big problem when I try to export from Crystal Report 8.5 in .pdf from VB6. I use a database made in SQL Server 2000. The problem is that all the decimal fields in database are...
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
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...
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...
1
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...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.