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
Prabhu RajaPosted Oct 5, 2011, 2:54 AM
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
Kanhialal kkPosted Oct 5, 2011, 12:19 AM
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();
}
Sam HobbsPosted Oct 4, 2011, 12:17 PM
Mamta MPosted Oct 4, 2011, 6:03 AM
http://msdn.microsoft.com/en-us/library/system.windows.forms.combobox.beginupdate.aspx
Kanhialal kkPosted Oct 4, 2011, 5:20 AM
yes there are thousands invoice to display in combobox..
..
NarayanPosted Oct 4, 2011, 4:46 AM
Mamta MPosted Oct 4, 2011, 4:43 AM
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.