O'Reilly logo
  • collins christopher thinks this is interesting:

C# SqlCommand dataAction = new SqlCommand(sqlText, linkToDB); IAsyncResult pending = dataAction.BeginExecuteNonQuery(); while (pending.IsCompleted == false) { // ----- Do work as needed, or... Threading.Thread.Sleep(100); } dataAction.EndExecuteNonQuery(pending); Visual Basic Dim dataAction As New SqlCommand(sqlText, linkToDB); Dim pending As IAsyncResult = dataAction.BeginExecuteNonQuery() Do While (pending.IsCompleted = False) ' ----- Do work as needed, or... Threading.Thread.Sleep(100) Loop dataAction.EndExecuteNonQuery

From

Cover of Microsoft® ADO.NET 4 Step by Step

Note

Processing Asynchornously