Salve ragazzi,
ho fatto un piccolo programmino in vb.net che lancia 2 thred che eseguono delle operazionio sul database Sql server.

Ho notato pero che se abilito entrambi i thread, ci sono problemi con il database (non mi resituisce nessun valore), mentre se faccio eseguire un solo thread per volta funziona tutto perfettamente.
Da cosa può dipendere??.

codice:
    Public Function OpenSQLConnection() As SqlConnection

        If gtpSettaggi.AutenticazioneDatabase.ToLower = "w" Then

            m_ConnectionString = "Server=" & ServerName & ";Database=" & DbName & ";Trusted_Connection=True; "

            'm_ConnectionString = "Data Source=" & ServerName & ";" & _
            '                    "Initial Catalog=visualtrac;Integrated Security=SSPI;" & _
            '                      "MultipleActiveResultSets=True"
        Else
            m_ConnectionString = "Server=" & ServerName & ";Database=" & DbName & ";User ID=" & DbUserName & ";Password=" & DbPwd & ";Trusted_Connection=False;"
        End If

        mSqlConn = New SqlConnection(m_ConnectionString)

        Try
            mSqlConn.Open()
        Catch ex As Exception

            Return mSqlConn

        End Try

        Return mSqlConn


    End Function
Io ad ogni queri che eseguo apro la connessione (con il codice sopra) e infine la chiudo cosi:

codice:
        If IsNothing(mSqlConn) = False Then
            mSqlConn.Close()
        End If