I now have a private void GetInfoFromSQL() (see code snippet) with which a fill a combobox with data which is run from private void Window_Shown(..) but it takes too long to load them up.
Can anyone help me out and transform my code into a working "asynchronous data access" code example ?
Eg the combobox is disabled until the asynchronous method has finished loading the data into the combobox.
(I'm using visual studio 2010 with .net 4.0 )
private void GetInfoFromSQL()
string ConnectionString = "Data Source=MOM\\STRU;Initial Catalog=Contacts;user id=sa;password=secret";
SqlConnection conn = new SqlConnection(ConnectionString);
SqlDataReader rdr = null;
SqlCommand cmd = new SqlCommand("SELECT DISTINCT First_Name + ' ' + Last_Name + ' (' + Org_Name + ')' AS Expr1 FROM dbo.NAME ORDER BY Expr1", conn);
rdr = cmd.ExecuteReader();
for (int i = 0; i < rdr.FieldCount; i++)