Dear all,
I have a VC# (winforms) application written in Visual studio 2003 with .Net framework 1.1, here I want to populate 6 listboxes with bulk amount of data ( Eg. combox A and B each with 20000 items , combobox C and D each with 4500 items , combox E and F each with 100 items). I am using a stored procedure here , Please see the following example ( other stored proceduers and code blocks are also same but having differnt names) it takes around 40 Minuts to load the form with populated controls....!!!!!
/* SP */
CREATE PROCEDURE sp_name AS
begin
select id,name from tableName order by name
end
GO
/* VC# code */
SqlCommand m_CMD = new SqlCommand("sp_name",m_con); // EXECUTING STORED PROCEDURE TO LOAD ITEMS
m_CMD.CommandType = CommandType.StoredProcedure;
m_con.Open();
SqlDataReader m_dr ;
m_dr = m_CMD.ExecuteReader();
while (m_dr.Read())
{
lb_ID.Items.Add(m_dr.GetValue(0).ToString());
lb_Name.Items.Add(m_dr.GetValue(1).ToString());
}
m_dr.Close();
m_con.Close();
/* Code ends */
I want to optimize the code, Any body having Idea ?