Hi allI have some trouble with loading large amount of datainto a UltraWinGrid.I need to load about 100'000 rows into a grid and thewait time for the user should be as smallest possible ... :-)When I execute the query in the SQL Management Studio,the result grid startes almost immediately with loading.In the WinGrid I already use OnDemand loading but it takessome seconds to show the rows. I also know why: becauseI use a DataSet to fill the Grid and the DataSet has to be loaded first.The question now is:How can I load large amount of data from SQL Server into your WinGrid ?The grid should start showing rows immediately (something like asynchron) ...Hope you understand what I mean ...Thanks for a quick feedback andbest regardsFrank UrayP.S. I would pay for a really good solution
Hi Frank,
Which part of this is slow? Is it the loading of 100,000 rows into a DataTable? Or the binding of that DataTable to the grid?
If it's the DataTable, then I'm not sure there's very much you can do there. There are probably some third-party data source objects that are faster and more efficient than a DataTable. But I don't have any experience with specific ones.
If it's the grid, then you will want to check out the Virtual Mode sample in either the WinGrid samples explorer or the UltraDataSource samples. Setting the LoadStyle of the grid to LoadOnDemand will not do very much unless you also have a data source that can support loading data on-demand.
Hi MikeThanks for your help.I am right now looking at the samples.I am not clear how this would be done when I have a DataTablewith all the data in it ?Where do I have to set the DataTable to the UltraDataSource ?Thanks and best regardsFrank Uray
You don't set one to the other. The UltraDataSource fires events to let you know when you need to supply it with data for any particular row. It requires some coding. The sample just generated the data in code, but your application will get the data from the DataTable - or wherever you want, really. Neither the grid nor the UltraDataSource have any knowledge of where the data comes from.
Hi MikeThanks for your answer,but now I am really confused ... :-))What do I have to do when I have a DataTable with all theData in it ? I would like to display this data like it isin this One million row sample .Thanks and best regardsFrank Uray
I'm confused by your confusion. :) What part of this is confusing you?
The way the million rows sample works is that there's a grid and an UltraDataSource. The UDS has it's data structure set up with columns and it fires events like CellDataRequested when it need the data for a row.The code handles this event and passes back the data to be displayed for that row.The same just uses fake data that is generated in the code. But in your case, you would use the data from your DataTable.
Hi MikeThats what I am trying to ask ...I have a UltraDataSource, a UltraGrid, a DataTable with data.What do I have to set to fill the Grid using the DataSource ??Best regardsFrank Uray
You set up the bands and columns of the UltraDataSource to mirror your DataTable and display what you want in the grid. Then you bind the grid to the UltraDataSource, just like the sample is doing. Then you set the Count of the grid rows to the count of the rows in your data table, just like the sample is doing. Then you handle the events of the UltraDataSource such as CellDataRequested, just as the sample is doing.
Mike,
As many people ask the same question over and over again, why don't you just give us a complete sample? Here is the common scenario:
* I have a SQL Server database and Orders table has three columns (ID, orderDate, orderAmont)
* I have setup a connection and a SqlCommand and I want to read it with SqlDataReader - say "Select * from Orders"
Could you please share a sample to get the data and bind to a WinGrid using LoadOnDemand?
Thank you