I have a form that is taking a long time to fill a ListBox on Middle Tier.
Here is the ListBox code:
Code: Select all
public void FormAnesthProvLocations_Load(object sender, System.EventArgs e) {
List<Provider> listShort = new List<Provider>();
listShort = Providers.GetDeepCopy(true);
this.listProv.Items.Clear();
for(int i=0;i<listShort.Count;i++) {
this.listProv.Items.Add(Lan.g(this,listShort[i].GetLongDesc()));
}
this.listLocation.Items.Clear();
DataTable table = AnesthLocations.RefreshCache();
locationCur = new AnesthLocation();
for(int i=0;i<table.Rows.Count;i++) {
locationCur.LocationNum = PIn.Long(table.Rows[i][0].ToString());
locationCur.LocationName = PIn.String(table.Rows[i][1].ToString());
listLocation.Items.Add(locationCur.LocationName);
}
string bob = String.Empty;
this.listProv.SelectedIndex = 0;
}
Code: Select all
public static DataTable RefreshCache() {
//No need to check RemotingRole; Calls GetTableRemotelyIfNeeded().
string command="SELECT * FROM anesthlocation ORDER BY LocationName";
DataTable table=Cache.GetTableRemotelyIfNeeded(MethodBase.GetCurrentMethod(),command);
table.TableName="AnesthLocation";
FillCache(table);
return table;
}