title: Exception message when trying to load data to DataGridView
body: <pre class="lang-vb prettyprint-override"><code>Imports System.Data.SqlClient
  
  Public Class SQLCONTROL
      Private DBcon As New SqlConnection("Data Source=DESKTOP-DQ7NOIF\SQLEXPRESS;Integrated Security=True")
      Private DBcom As New SqlCommand
  
      Public DBDA As SqlDataAdapter
      Public DBDT As DataTable
      Public Params As New List(Of SqlParameter)
      Public RecordCount As Integer
      Public Exception As String
  
      Public Sub New()
  
      End Sub
  
      Public Sub New(ConnctionString As String)
          DBcon = New SqlConnection(ConnctionString)
  
      End Sub
  
      Public Sub ExecQuery(Query As String)
          RecordCount = 0
          Exception = ""
  
          Try
              DBcon.Open()
              DBcom = New SqlCommand(Query, DBcon)
              Params.ForEach(Sub(p) DBcom.Parameters.Add(p))
              DBDT = New DataTable
              DBDA = New SqlDataAdapter(DBcom)
              RecordCount = DBDA.Fill(DBDT)
          Catch ex As Exception
              Exception = "ExecQuery Error" &amp; vbNewLine &amp; ex.Message
          Finally
              If DBcon.State = ConnectionState.Open Then DBcon.Close()
  
          End Try
      End Sub
  
      Public Sub AddParam(Name As String, Value As Object)
          Dim NewParam As New SqlParameter(Name, Value)
          Params.Add(NewParam)
      End Sub
  
      Public Function HasException(Optional Report As Boolean = False) As Boolean
          If String.IsNullOrEmpty(Exception) Then Return False
          If Report = True Then MsgBox(Exception, MsgBoxStyle.Critical, "Exception:")
          Return True
      End Function
  
  End Class
  </code></pre>
  
  <p>the exception message is "A first chance exception of type 'System.Data.SqlClient.SqlException' occurred in System.Data.dll</p>
  
  <p>Additional information: Nom d'objet 'Utilisateurs' non valide."</p>
  
  <p>thanks</p>