开发者

filling dataset with thousands of records

I am using oracle as back end. In database there is a table with 5000 records and 160 columns. i want to display all th开发者_如何学Goese records in gridview(in asp.net, c#). But it takes more than 10 minutes to fill the dataset. Can you suggest any other option? Is it possible using thread?


My guess is its not the .net code that's taking 10 minutes. Step through your code and find the choke point where its taking all that time. It very well could be you database query. If it is the query then you need to figure out ways to tune it.

Also, no user needs to look at 5000 records with 160 columns. Figure out a better way to display this information, providing drilldown or other ways to make sense of and navigate through all that data. Other than that you could try paging instead.

And yea, don't use another thread for this. This is a design that needs to be reworked.


hejdig.

I had a somewhat similar scenario some years ago where we had a discusison whether it was the grid or the query&datahandling that took time. It was in WinForm 2.0 but the problem is the same.

We downloaded a profiler and got the answer in a few minutes. The grid. The query and handling of data was just a few percent of the time.

If you try to download 5000 rows into a datagrid in aspnet you might choke the system. Start with turning of viewstate. You lose a lot of functionality but gain bits. Run a profiler. Look into using a grid other than MS's datagridview. Try paging. Aproximately in this order.

If you know your users you might save a spreadsheet for them to open. There are also some simple tricks to open a page as a spreadsheet (just output CSV or XML and change MIME type). If it is the GUI that takes time that is.

Happy hacking and good hunt.

/OF


Adding another thread is not the solution and might make your code too complex. Retieving a record should be simple but since you're retieving that much it would likely to be slow. Try putting data paging on the database side, this would minimize databinding time & the amount of data being passed to the network.


In such scenario instead of using gridview paging you can use dynamic paging and get only those records from database which are specific to page only.

http://www.codeproject.com/KB/custom-controls/ASPNETPagerControl.aspx

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜