View previous topic :: View next topic |
Author |
Message |
flc.net
Joined: 21 Jun 2005 Posts: 89 Location: Switzerland
|
Posted: Tue Apr 25, 2006 4:16 pm Post subject: Delayed DataLoad |
|
|
Dear Support
in our project we do have over a 50'000 rows. As the stored procedure is too slow for such a lot of data we want to load data delayed into the dataset. I tried to solve this with VirtualTree but didn't succeed. Can you please complete my sample app?
Thanks a lot
Giuseppe |
|
Back to top |
|
|
Infralution
Joined: 28 Feb 2005 Posts: 5027
|
Posted: Wed Apr 26, 2006 9:24 am Post subject: |
|
|
ADO.NET is not really designed to handle this sort of scenario. ADO.NET is designed as disconnected database model. For a database with 50000+ rows you are probably going to be loading 20Mb+ of data alone into memory. This will not only be slow but is a waste of memory.
If you don't need the disconnected model (ie your product isn't a web service and doesn't have 1000's of users) then you should consider using our Virtual Data Objects (VDO) product. This allows to display millions of rows with virtually no memory overhead because it uses a server side cursor to get data, as it is required, into memory. VDO is also (in our opinion) much easier to use than ADO.NET when it comes to saving changes into the database.
Check out the Virtual Tree Database Browser sample - it uses VDO to browse a large database. _________________ Infralution Support |
|
Back to top |
|
|
flc.net
Joined: 21 Jun 2005 Posts: 89 Location: Switzerland
|
Posted: Wed Apr 26, 2006 9:59 am Post subject: |
|
|
Infralution wrote: | ADO.NET is not really designed to handle this sort of scenario. ADO.NET is designed as disconnected database model. For a database with 50000+ rows you are probably going to be loading 20Mb+ of data alone into memory. This will not only be slow but is a waste of memory. |
I'm sorry, probably i wasn't so clear.
I have 3 levels
Level 1 : 20 Rows
Level 2: 100 Rows (for each Level 1)
Level 3: 25 Rows (for each Level 2)
If I load everything into the DataSet i have a total of 50k Level 3 Rows.
My Idea was to get just all the Level 1 Rows
After Expand one Level 1 Row in VT, get the 100 Level 2 Rows and so on...
I tried to do something, in the GetChildren Event of VT.. but i have no idea how to do it.
Thanks
Giuseppe |
|
Back to top |
|
|
Infralution
Joined: 28 Feb 2005 Posts: 5027
|
Posted: Thu Apr 27, 2006 1:24 am Post subject: |
|
|
Yes you can load parts of your dataset on demand by handling the GetChildren event. The following is for your sample project:
Code: |
private void virtualTree1_GetChildren(object sender, Infralution.Controls.VirtualTree.GetChildrenEventArgs e)
{
DataRowView drv = e.Row.Item as DataRowView;
if (drv != null)
{
MyDataSet.CompanyRow cr = drv.Row as MyDataSet.CompanyRow;
if (cr != null)
{
if (cr.GetPersonRows().Length == 0)
{
for (int i = 0; i < 20; i++)
{
myDataSet1.Person.AddPersonRow(cr.CompanyName + i.ToString(), cr);
}
}
}
}
RowBinding rowBinding = virtualTree1.GetRowBinding(e.Row);
e.Children = rowBinding.GetChildrenForRow(e.Row);
}
|
In real code where the data comes from a database you would use a data adapter to fill (add) the person rows. The last two lines call the default rowBinding method for getting the children.
You should also consider setting the ChildPolicy for the Company row to LoadOnExpand so that you don't end up loading the data as the user scrolls through the list.
We'll email you back the modified sample project. _________________ Infralution Support |
|
Back to top |
|
|
flc.net
Joined: 21 Jun 2005 Posts: 89 Location: Switzerland
|
Posted: Thu Apr 27, 2006 6:52 am Post subject: |
|
|
great. thanks a lot.
giuseppe |
|
Back to top |
|
|
Infralution
Joined: 28 Feb 2005 Posts: 5027
|
Posted: Thu Apr 27, 2006 7:10 am Post subject: |
|
|
It still would be worthwhile taking a look at Virtual Data Objects. It really is much easy to use than ADO.NET when you are in a connected environment (eg desktop applications) and is much faster and more memory efficient as well. _________________ Infralution Support |
|
Back to top |
|
|
|