Hi,
I have an aspx page which lets user input their report parameter. When they submit the form, the code will query the database and send the content (CSV) using the response stream.
1 Response.Clear()
2 Response.AddHeader("content-disposition", "attachment;filename=file.csv")
3 Response.ContentType = "text/x-csv"
4
5 For Each dr As DataRow In dt.Rows
6 ' retrieve values from each column into the variable "line"
7 Response.Write(line)
8 Response.Flush()
9 Next
10
11 Response.End()
When the dataset is large (over 90,000 records, about 25MB) ...
Go to the complete details ...