none
Loading and Binding large amount of data from server to client RRS feed

  • Question

  • I have a grid and data base server has 1million rows. I bind data to the grid on windows client. As it stands, when i tries to load the data, it loads everything in one shot and hence it takes too long to show the data on the screen.

    Is there a way I can stream data in chunk and bind to grid such that it would load more data in stages instead of waiting for whole dataset?

    Something similar to the grid in SQL management studio which loads data in chunks when query returns too much of data.

    Looking for some good advises... Reducing data load by using where clause is not the answer here... 

    Thursday, April 7, 2011 5:49 PM

Answers

  •  

    Hi Bravo2007,

    Welcome!

    According to your description, you mean you don't want to let your client wait for loading the whole data? I have some suggestions, I hope one of them could help you.

    1.1million rows are really large records, I think you could page your records. for example every pages show 20 rows, you can do it in database by T-SQL:

    //page

    Select top(20) * from Database where (id not in select top(page*20) from Database order by id) order by id

    When you click next page will trigger Ado.net to retrieve the records which are small, so it will not let you wait.

    2.You can use multi-Thread to handle your scenario, for example BackgroundWorker Class (In WinForm)(http://msdn.microsoft.com/en-us/library/system.componentmodel.backgroundworker.aspx#Y2898) it will allow you to run retrieve records on a separate, you needn't wait for loading records on the client, but the records couldn't appear until all records loaded.

     If the suggestions couldn't meet your question and your project is a Winform, I think you can try here:  http://social.msdn.microsoft.com/Forums/en/winforms/threads If it's a web application, you can try here: http://forums.asp.net/19.aspx/1?Custom+Server+Controls

    Have a nice weekend.


    Alan Chen[MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Friday, April 8, 2011 1:45 PM
    Moderator

All replies

  •  

    Hi Bravo2007,

    Welcome!

    According to your description, you mean you don't want to let your client wait for loading the whole data? I have some suggestions, I hope one of them could help you.

    1.1million rows are really large records, I think you could page your records. for example every pages show 20 rows, you can do it in database by T-SQL:

    //page

    Select top(20) * from Database where (id not in select top(page*20) from Database order by id) order by id

    When you click next page will trigger Ado.net to retrieve the records which are small, so it will not let you wait.

    2.You can use multi-Thread to handle your scenario, for example BackgroundWorker Class (In WinForm)(http://msdn.microsoft.com/en-us/library/system.componentmodel.backgroundworker.aspx#Y2898) it will allow you to run retrieve records on a separate, you needn't wait for loading records on the client, but the records couldn't appear until all records loaded.

     If the suggestions couldn't meet your question and your project is a Winform, I think you can try here:  http://social.msdn.microsoft.com/Forums/en/winforms/threads If it's a web application, you can try here: http://forums.asp.net/19.aspx/1?Custom+Server+Controls

    Have a nice weekend.


    Alan Chen[MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Friday, April 8, 2011 1:45 PM
    Moderator
  • Hi Bravo2007,

     

    I am writing to check the status of the issue on your side.  Would you mind letting us know the result of the suggestions? 
     
    If you need further assistance, please feel free to let me know.   I will be more than happy to be of assistance.

    Have a ncie day.


    Alan Chen[MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Friday, April 15, 2011 12:57 PM
    Moderator