C#

Export Datatable To excel .cvs File with c#

DataTable dtUsers = Session[“UsersForApproval”] as DataTable; DataTable dtexprot = new DataTable(); if (Session[“UsersForApproval”] == null) { dtexprot = UserDetails.GetUsersForApproval(); Session[“UsersForApproval”] = dtUsers; } else { dtexprot = Session[“UsersForApproval”] as DataTable; } HttpContext context = HttpContext.Current; context.Response.Clear(); foreach (DataColumn column in dtexprot.Columns) { context.Response.Write(column.ColumnName + “,”); } context.Response.Write(Environment.NewLine); foreach (DataRow row in dtexprot.Rows) { for (intContinue Reading “Export Datatable To excel .cvs File with c#”