Posted on: 5/10/2011 4:59:11 AM | Views : 376

Hello. I'm creating CSV file from database data. If I put this code to page load on different page, it is working.
protected void btGenDown_Click(object sender, EventArgs e) { Response.Clear(); Response.AddHeader("content-disposition", "attachment; filename=export.csv"); Response.ContentType = "text/csv"; OracleConnection con = new OracleConnection(ConfigurationManager.ConnectionStrings["OraAspNetConString"].ConnectionString); OracleCommand cmd = new OracleCommand(finalSql, con); con.Open(); OracleDataReader thisReader = cmd.ExecuteReader(); while (thisReader.Read()) { for (int i = 0; i < countSelections; i++) { if (thisReader.IsDBNull(i)) Response.Write("NULL"); else Response.Write(thisReader.GetD ...

Go to the complete details ...