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();
}