This reproduces it
Code: Select all
MySqlConnection1.Open()
Try
Dim c As New MySqlCommand("SELECT SLEEP(10)", MySqlConnection1)
c.CommandTimeout = 5
Debug.Print("Initial State: " & [Enum].GetName(GetType(System.Data.ConnectionState), MySqlConnection1.State))
c.ExecuteNonQuery()
Catch ex As Exception
Debug.Print("Timeout Exception: " & ex.ToString())
End Try
Debug.Print("State after timeout: " & [Enum].GetName(GetType(System.Data.ConnectionState), MySqlConnection1.State))
Try
Dim c As New MySqlCommand("SELECT SLEEP(1)", MySqlConnection1)
c.CommandTimeout = 5
Debug.Print("State just before new command: " & [Enum].GetName(GetType(System.Data.ConnectionState), MySqlConnection1.State))
c.ExecuteNonQuery()
Catch ex As Exception
Debug.Print("New command exception: " & ex.ToString())
End Try
MySqlConnection1.Close()
i would expect the second command to work fine as the COMMAND timed out and not the connection.Initial State: Open
A first chance exception of type 'Devart.Data.MySql.MySqlException' occurred in Devart.Data.dll
Timeout Exception: Lost connection to MySQL server during query
State after timeout: Open
State just before new command: Open
A first chance exception of type 'Devart.Data.MySql.MySqlException' occurred in Devart.Data.dll
New command exception: Lost connection to MySQL server during query