I"m trying to send the user a pretty decent about of data could be about 200,000 records or more. WHen i run the selections it always times out. If i run smaller ones it works. Heres the code to export: I'm i goign about this wrong, is there a better way to achieve what i want in terms of performance. I need to get the user a csv file of data from a stored procedure.
public void ExcelExportCSV(SqlDataReader dr )
{
HttpResponse response = HttpContext.Current.Response;
HttpContext context = HttpContext.Current;
context.Response.Clear();
while (dr.Read())
{
context.Response.Write(dr.GetValue(0)+ ",");
context.Response.Write(dr.GetValue(1) + ",");
context.Response.Write(dr.GetValue(2) + ",");
context.Response.Write(dr.GetValue(3) + ",");
context.Response.Write(dr.GetValue(4) + ",");
context.Response.Write(dr.GetValue(5) + ",");
}
context.Response.Write(Environment.NewLine);
context.Response.ContentType = "text/csv";
context.Response.AppendHeader("Content-Disposition", "attachment; filename=membSel.csv");
context.Response.End();
}