Unni R

Unni R

  • NA
  • 16
  • 11.2k

How to export all the files in PDF format at a time

May 30 2015 8:12 AM
How to export multiple files in PDF format through ASP.NET at a time. File format is already updated in Crystal report. My code attached here. this is use to only one PDFfile save at a time.
public void updatestaus(string F) {         sc.Close();         sc.Open(); SqlCommand cmd = new SqlCommand("update BOND_REG set status='P' where fliono='"+F+"'", sc);         cmd.ExecuteNonQuery();         sc.Close(); } protected void Btnclose_Click(object sender, EventArgs e) { Response.Redirect("master.aspx"); } protected void Button2_Click(object sender, EventArgs e) {         sc.Open(); SqlCommand cmd = new SqlCommand("select Fliono from BOND_REG where status='A'", sc); SqlDataReader SDR = cmd.ExecuteReader(); while (SDR.Read() == true) { string St = SDR.GetValue(0).ToString(); //SDR.Close(); // SDR.Dispose();             fileexport(St);             updatestaus(St); }         SDR.Close();         sc.Close(); } public void fileexport(string st1) { // SDR.Close();  SqlCommand cmd1 = new SqlCommand("select * from BOND_REG where status='A' and Fliono='" + st1 + "'", sc); SqlDataAdapter da = new SqlDataAdapter();         da.SelectCommand = cmd1; DataTable datatable = new DataTable();         da.Fill(datatable); ReportDocument crystalReport = new ReportDocument();         crystalReport.Load(Server.MapPath("~/bond.rpt"));         crystalReport.SetDataSource(datatable); ExportOptions rptExportOption; DiskFileDestinationOptions rptFileDestOption = new DiskFileDestinationOptions(); PdfRtfWordFormatOptions rptFormatOption = new PdfRtfWordFormatOptions(); string reportFileName = @"C:\pdfd\ st1.pdf";         rptFileDestOption.DiskFileName = reportFileName;         rptExportOption = crystalReport.ExportOptions; {             rptExportOption.ExportDestinationType = ExportDestinationType.DiskFile;                        rptExportOption.ExportFormatType = ExportFormatType.PortableDocFormat;             rptExportOption.ExportDestinationOptions = rptFileDestOption;             rptExportOption.ExportFormatOptions = rptFormatOption; }          crystalReport.Export(); }
 

Answers (1)