Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // meanwhile: show the user that you are busy:
- this.ShowBusy(true); // show picture box?
- // if needed do other things you can do before the data is fetched
- this.ClearTable();
- // once you have nothing meaningful to do, await for your data
- MyData fetchedData = await fetchDataTask;
- this.ProcessData(fetchedData);
- // finished:
- this.ShowBusy(false); // remove picture box
- // continue while opening:
- using (var sqlCommand = new SqlCommand(...))
- {
- cmd.Parameters.AddWithValue(...);
- // before executing the query: wait until OpenAsync finished:
- await taskOpen;
- // read the data. If nothing to do: await, otherwise use Task similar to Open
- SqlDataReader dataReader = await cmd.ExecuteReaderAsync();
- foreach (var row in dataReader)
- {
- ... (some Await with GetFieldValueAsync
- }
- }
- }
Add Comment
Please, Sign In to add comment