Want to optimize the performence

vb.net , sql server 2000 , framework 1.1 India
  • 12 years ago
    Hello All this is amit, Presently I m using Devexpress treelist control. Every thing is working fine. But the problem is when I m assinging the dataTable to tree it taking lot of time. Presently my datatable containing 567 rows. Below I m giving my bolck of code. Private Sub ProtocolTreeFormation(ByVal tree As DevExpress.XtraTreeList.TreeList)Dim treeRow As NewProtocolEditorDS.OrganAndProtocolTreeRow For Each OrganProtocolRow As NewProtocolEditorDS.oOrganProtocolRelationRow In ProtocolDS.oOrganProtocolRelation For Each newOrganProtocolRow As NewProtocolEditorDS.oOrganProtocolRelationRow In ProtocolDS.oOrganProtocolRelation.Select("OrganSystemCode = '" & OrganProtocolRow.OrganSystemCode & "'") For Each rowOrganSys As NewProtocolEditorDS.oKdbOrganSystemRow In ProtocolDS.oKdbOrganSystem.Select("OrganSystemCode = '" & newOrganProtocolRow.OrganSystemCode & "'") If ProtocolDS.OrganAndProtocolTree.Select("TreeTitle = '" & rowOrganSys.OrganSystemDesc & "'").Length = 0 Then treeRow = ProtocolDS.OrganAndProtocolTree.NewOrganAndProtocolTreeRow With treeRow .TreeChildId = 0 .TreeTitle = rowOrganSys.OrganSystemDesc .Treeid = rowOrganSys.OrganSystemCode End With ProtocolDS.OrganAndProtocolTree.AddOrganAndProtocolTreeRow(treeRow) organid = CInt(ProtocolDS.OrganAndProtocolTree(ProtocolDS.OrganAndProtocolTree.Count - 1).TreeParentID) End If Next For Each rowDetails As NewProtocolEditorDS.oProtocolDetailsRow In ProtocolDS.oProtocolDetails.Select("ProtocolHeaderID = " & newOrganProtocolRow.ProtocolHeaderID) treeRow = ProtocolDS.OrganAndProtocolTree.NewOrganAndProtocolTreeRow With treeRow .TreeChildId = organid .TreeTitle = rowDetails.ProtocolName .Treeid = rowDetails.ProtocolDetailsID End With ProtocolDS.OrganAndProtocolTree.AddOrganAndProtocolTreeRow(treeRow) pid = CInt(ProtocolDS.OrganAndProtocolTree(ProtocolDS.OrganAndProtocolTree.Count - 1).TreeParentID) For Each rowDrug As NewProtocolEditorDS.oProtocolDrugRow In ProtocolDS.oProtocolDrug.Select("ProtocolDetailsId = " & rowDetails.ProtocolDetailsID) treeRow = ProtocolDS.OrganAndProtocolTree.NewOrganAndProtocolTreeRow With treeRow .TreeChildId = pid .TreeTitle = rowDrug.DrugName .Treeid = rowDetails.ProtocolDetailsID End With ProtocolDS.OrganAndProtocolTree.AddOrganAndProtocolTreeRow(treeRow) Next Next Next Next ProtocolDS.OrganAndProtocolTree.AcceptChanges() tree.DataSource = ProtocolDS.OrganAndProtocolTree tree.KeyFieldName = "TreeParentID" tree.ParentFieldName = "TreeChildId" tree.Columns("Treeid").VisibleIndex = -1 tree.ExpandAll() FormatTree(tree) End Sub This Procedure taking a treelist as in input and inseting rocord into datatable and then assigning that table to treelist. Following property basicaly taking time. tree.DataSource = ProtocolDS.OrganAndProtocolTree tree.KeyFieldName = "TreeParentID" When I m trying to do this with thread it giving me the exception that object is already in use. Please help me. If you have any sugession then please mail me. My id is [email protected] Thanking You, Amit kumar

Post a reply

No one has replied yet! Why not be the first?

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“UNIX is basically a simple operating system, but you have to be a genius to understand the simplicity.” - Dennis Ritchie