Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void Stuff()
- {
- bool succes = false;
- int retryCount = 3;
- using (SqlConnection connection = new SqlConnection(connectionString))
- {
- connection.Open();
- while (retryCount > 0 && succes == false)
- {
- try
- {
- cmd setup stuff here..
- cmd.ExecuteNonQuery();
- succes = true;
- }
- catch (SqlException exception)
- {
- if (exception.Number != 1205)
- {
- throw;
- }
- Thread.Sleep(100);
- retryCount--;
- if (retryCount == 0) throw;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment