Hi...
I have a windows application which takes too time in loading
while I am performing only single task on load event,,
I am getting invoices from database onload...
and form take too much time approxmatily 15 seconds..
how can i increase the speed of the form.
Loading

Mamta MRank #268 · 9.4K reputationPosted Oct 4, 2011, 12:43 AM EDT
2) Find out ways to speed up your data retrieval operation.
3) Find out if you can place the code to get the data in any other method, instead of Load.
NarayanRank #8,477 · 221 reputationPosted Oct 4, 2011, 12:46 AM EDT
Kanhialal kkRank #8,477 · 221 reputationPosted Oct 4, 2011, 1:20 AM EDT
yes there are thousands invoice to display in combobox..
..
Mamta MRank #268 · 9.4K reputationPosted Oct 4, 2011, 2:03 AM EDT
http://msdn.microsoft.com/en-us/library/system.windows.forms.combobox.beginupdate.aspx
Sam HobbsRank #107 · 20.5K reputationPosted Oct 4, 2011, 8:17 AM EDT
Kanhialal kkRank #8,477 · 221 reputationPosted Oct 4, 2011, 8:19 PM EDT
sir there is only following code on page load..
adpt = new SqlDataAdapter("select invoiceno from Only_invoices order by invoiceno asc", conn);
dt = new DataTable();
adpt.Fill(dt);
if (dt.Rows.Count > 0)
{
cmbinvoice.BeginUpdate();
foreach (DataRow row in dt.Rows)
{
this.cmbinvoice.Items.Add(row["invoiceno"].ToString());
}
cmbinvoice.EndUpdate();
}
Prabhu RajaRank #861 · 2.6K reputationPosted Oct 4, 2011, 10:54 PM EDT
But i Suggest you to use DataReader instead of DataTable. It will be Speed enough.
SqlConnection con = SqlConnection("Your Connection String");
con.Open();
SqlCommand com = new SqlCommand("select invoiceno from Only_invoices order by invoiceno asc");
Com.Connection = con;
SqlDataReader reader = cmd.ExecuteReader();
While( reader.Read())
{
this.cmbinvoice.Items.Add(reader[0].ToString());
}
Thank You