none
Loading more than 15,000 rows into a DataTable (Performance issue) RRS feed

  • Question

  • Hi all,

    Does any one loaded a DataTable with thousands of rows using 'For' / 'ForEach' Loops... What about performance?....

    I do have tried with SqlDataReader.... Its nice.. it takes very few seconds and what we need is a connection string and I don't want to go in that way as I use COM dlls to talk with Database.

    I do have tried with For & ForEach loops and they r talking forever....... Can any one suggest nice way?

    with regards,
    YK
    Friday, August 15, 2008 9:35 PM

Answers

  • Limit the number of rows in the result. You can move your application logic to database procedures, or incorporate some paging mechanism.

    MSMVP VC++
    • Marked as answer by Zhi-Xin Ye Wednesday, August 20, 2008 11:15 AM
    Friday, August 15, 2008 11:06 PM

All replies

  • Limit the number of rows in the result. You can move your application logic to database procedures, or incorporate some paging mechanism.

    MSMVP VC++
    • Marked as answer by Zhi-Xin Ye Wednesday, August 20, 2008 11:15 AM
    Friday, August 15, 2008 11:06 PM
  • To add to the previous post you could use the T-SQL TOP clause to return much less rows and you can contact your Data team to create Views for you which gives you only the columns you need per operation.

    http://msdn.microsoft.com/en-us/library/ms189463(SQL.90).aspx


    Asp.net MVP, MCPD Web C#, MCITP BI & MCTS SQL Server 2005
    Thursday, August 28, 2008 5:20 PM
    Moderator