protected void Sssss_click (object sender, EventArgs e)
{
LocalReport report = new LocalReport ();
Report. Reportpath = @ "D:\PDFTEST.RDL";
DbProviderFactory dbf = Dbproviderfactories.getfactory ();
using (idbconnection con = dbf. CreateConnection ())
{
string sSQL;
sSQL = "Select Sponsor_title, Group_pdf_code, Provider_network, Effective_date, Build_type, Group_begin_date, REDLINE_ Posted_date, sponsor_title_changed, New_renewal_form, Pharmacy_complete, Administration_complete, ELIGIBILITY_ Finace_complete "+
", Healthx_complete, Cert_complete, Cert_audit_complete, Post_for_networks_date, redline_posted, COMPARE_PLAN_FORM, Assign_benefit_build_specialist, Begin_benefit_build, Compared_reviewed_plan, model_plan_copied, SELF_BENEFIT_ Audit_complete, assign_peer_review_specialist "+
", Peer_review_complete, Begin_cliams_auditing, Cliams_audit_complete, REMOVE_SPONSOR_FROM_WATHC, ESTIMATED_TOTAL_ Days, Original_est_cmplt_date, Healthx, Std_group_begin_date, Std_redline_posted_date, std_sponsor_title_changed, Std_new_renewal_form, Std_pharmacy_complete, Std_administration_complete, std_eligibility_finace_complete "+
", Std_healthx_complete, Std_cert_complete, Std_cert_audit_complete, Std_post_for_networks_date, STD_REDLINE_POSTED , Std_compare_plan_form, Std_assign_benefit_build_specialist, Std_begin_benefit_build, STD_COMPARED_REVIEWED_PLAN, Std_model_plan_copied, Std_self_benefit_audit_complete, Std_assign_peer_review_specialist, STD_PEER_REVIEW_ Complete, std_begin_cliams_auditing, Std_cliams_audit_complete, STD_REMOVE_SPONSOR_FROM_WATHC, STD_ESTIMATED_TOTAL _days "+
", Std_estimated_completion_date, std_original_est_cmplt_date from Vwtgs_plans_by_process_step order by SPONSOR_TITLE , Group_pdf_code, Provider_network, Build_type, group_begin_date ";
using (IDbCommand cmd = con. CreateCommand ())
{
Cmd.commandtext = sSQL;
using (DbDataAdapter da = dbf. Createdataadapter ())
{
((IDbDataAdapter) da). SelectCommand = cmd;
using (DataTable dt = new DataTable ())
{
Da. Fill (DT);
ReportDataSource Dataseta = new ReportDataSource ("DataSet", DT);
Report. Datasources.add (Dataseta);
}
}
}
}
Warning[] warnings;
String[] Streamids;
String MimeType;
string encoding;
string extension;
Byte[] bytes = report. Render ("Excel", NULL, out-mimeType, out-encoding, out extension,
Out Streamids, out warnings);
FileStream fs = new FileStream (@ "D:\output.xls", FileMode.Create);
Fs. Write (bytes, 0, bytes. Length);
Fs. Close ();
}
Export the RDL file to an Excel file by LocalReport