I have an ASP page which will query records from a DB Table and do some processing and then Render an HTML table in the browser.My table has more than 16000 rows in it. When i am running the prigram with select top 2500 StudId,StudName from StudentsTbl, It is working fine.But when i am Using select "StudId,StudName from StudentsTbl",It is not showing any out put. I am using Response.flush() after every 50 records in the while loop.Can any one tell me how to solve this ? Thanks in advance
Based on your description of the problem, I'm betting that you're using IE as your test browser. The Response.Flush() is outputting HTML, but it will not display right away because IE doesn't know how to render a table incrementally. Instead, IE waits for the entire table to output before it draws it to the browser window. Your script isn't the problem, IE is.
With that being said, I want to point out that your design is fundamentally flawed. Think about your script from a usability perspective: there is no sane reason why you need to output 16000 rows of data all at once. Page your recordset in SQL, or limit the recordset to first 1000 rows using a TOP clause.
Actaully I would create an Excel file from this ASP page by adding Response..ContentType = "application/vnd.ms-excel" Thats y i need to generate the all data one time
Try outputting it as a table to the browser - I bet you get a "Script Timed Out" error.
Best bet would be to up the timeout interval. You can do that with a bit of code at the start of the script or you can do that as a global server setting. I would recommend the former.
Server.ScriptTimeout = 3939393
put it at the top of your page (I just choose a random high number). I assume you are getting a timeout from IIS. Default is 90 seconds.
Take away your response.flush, it only makes it slower as the server has to output every X ms to the client. Buffer the entire page instead (should be set as default in IIS for better performance).
If it still fails, what is the error? Maybe your databas is slow.