protected void Button2_Click(object sender, EventArgs e) { var l = new List(); sc.Open(); SqlCommand cmd = new SqlCommand("select Fliono from BOND_REG where status='A'", sc); SqlDataReader SDR = cmd.ExecuteReader(); while (SDR.Read() == true) { var item1 = SDR.GetValue(0).ToString(); l.Add(item1); } fileexport(l); updatestaus(l); SDR.Close(); sc.Close(); } public void updatestaus(List F) { StringBuilder sb = new StringBuilder(); for (int i = 0; i < F.Items.Count - 2; i++) { sb.Append(F.Items[i].ToString() + ","); } sb.Append(F.Items[F.Items.Count - 1].ToString()); sc.Close(); sc.Open(); SqlCommand cmd = new SqlCommand("update BOND_REG set status='P' where fliono IN ('" + sb.ToString() + "')", sc); cmd.ExecuteNonQuery(); sc.Close(); } public void fileexport(List F) { // SDR.Close(); StringBuilder sb = new StringBuilder(); for (int i = 0; i < F.Items.Count - 2; i++) { sb.Append(F.Items[i].ToString() + ","); } sb.Append(F.Items[F.Items.Count - 1].ToString()); SqlCommand cmd1 = new SqlCommand("select * from BOND_REG where status='A' and Fliono IN ('" + sb.ToString() + "')", 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(); }
List<string> l = new List<string>;
//var l = new List(); List<string> l = new List<string>(); </string></string>
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)