Data retrival time and combo load

  • Thread starter Thread starter kk
  • Start date Start date
K

kk

Have 2 problems, any help is appreciated.

Tab with Grids
--------------
BL - fetching data from DB ( 5 secs - 10 rows)
Grid Laod - 20 secs
Grid Paint on tab change - 20 secs

Problem: The data fetch only takes 5 secs, why does paint
and load take 40 secs in total.
Is there any reason why it is very slow.


Combo loads
-----------
Combo loaded with data binding using a collection of
business layer objects, how can we add a string
named 'ALL' to the combo box without creating an empty
object and adding it to the array collection.

Thanks,
 
Thank you for the prompt reply.

1st issue :
--------------------------------------------------------
Loading Grid
------------
1) creating new rows in a datatable and adding data a
array list to datatable.

ArrayList arrData = new ArrayList();
arrData = Employee.GetAll();

DataTable dt = new DataTable();
DataRow dr = new DataRow();
for(i=0; i< arrData.Count; i++)
{
dr = dt.NewRow();
dr["Age"] = ((Employee)arrData).Age;
dr["Name"] = ((Employee)arrData).Name;
dr["Object"] = arrData;
}

2) From datatable populating the grid
Total time taken for this is 40 secs.
Grid.DataSource = dt;

Clicking on tabs at runtime with grids in each tab
--------------------------------------------------
3) Even though the grid is loaded with data, it takes
full 20 secs for the grid to show on each tab when
switching between tabs at runtime. Grid painting is
time consuming.

2nd issue:
----------------------------------------------------------
Tried the InsertAt after the data binding and it did not
work, complained that positions for items cannot be
changed. Also tried inserting before the binding,
although there were no runtime errors, the "All" entry was
overwritten by the databinding.

public static void LoadCombo(System.Windows.Forms.ComboBox
cbo, ICollection data, string display, string key)
{
ArrayList arData = (ArrayList) data;
if (arData.Count == 0)
{
cbo.DataSource = null;
}
else
{
cbo.DataSource = arData;
cbo.DisplayMember = display;
cbo.ValueMember = key;
cbo.Items.insert(0,"All"); -- Did not work
}
 
Back
Top