Hello,
The following code works fine as long as it is within the main thread of a VB app:
Imports MySql.Data.MySqlClient
Imports System.Data
Imports Utilities
Public Class Command
Private con As MySqlConnection
Private cmd As MySqlCommand
Private rec As MySqlDataReader
Public Sub New()
Try
con = New MySqlConnection()
con.ConnectionString = "... blah blah..."
con.Open()
cmd = New MySqlCommand()
cmd.Connection = con
[...]
Catch e As Exception
Logger.Log(e.Message & vbCrLf & e.StackTrace)
End Try
End Sub
... but when it runs in a new thread, it fails here:
con = New MySqlConnection()
I cannot figure out what the problem is since the thread hangs right away and the sole exception that get trapped is:
System.Threading.ThreadAbortException {Unable to evaluate expression.}
I've been googlling it for 2 days, found similar cases with using ASP (which also instanciates threads btw...) but no good answer. Any clue getns ?
The following code works fine as long as it is within the main thread of a VB app:
Imports MySql.Data.MySqlClient
Imports System.Data
Imports Utilities
Public Class Command
Private con As MySqlConnection
Private cmd As MySqlCommand
Private rec As MySqlDataReader
Public Sub New()
Try
con = New MySqlConnection()
con.ConnectionString = "... blah blah..."
con.Open()
cmd = New MySqlCommand()
cmd.Connection = con
[...]
Catch e As Exception
Logger.Log(e.Message & vbCrLf & e.StackTrace)
End Try
End Sub
... but when it runs in a new thread, it fails here:
con = New MySqlConnection()
I cannot figure out what the problem is since the thread hangs right away and the sole exception that get trapped is:
System.Threading.ThreadAbortException {Unable to evaluate expression.}
I've been googlling it for 2 days, found similar cases with using ASP (which also instanciates threads btw...) but no good answer. Any clue getns ?