Imports System.Data.OleDb Public Class Data Public oDataAdapter As OleDbDataAdapter Public oDataSet As DataSet Public oDataView As DataView Public cSQL As String Public cConnectionString As String Public oConnection As OleDbConnection Public nCount As Integer ' SQL exec ' expC1 SQL command ' expO1 Connection Public Function SQLExec(ByVal tcSQL As String, ByVal tcConnection As String) As Boolean Dim llSuccess As Boolean Dim loConnection As OleDbConnection Dim lnStatus As Integer llSuccess = False cSQL = tcSQL cConnectionString = tcConnection Try lnStatus = 1 loConnection = New OleDbConnection(tcConnection) lnStatus = 2 loConnection.Open() lnStatus = 3 oDataAdapter = New OleDbDataAdapter lnStatus = 4 oDataAdapter.SelectCommand = New OleDbCommand(tcSQL, loConnection) lnStatus = 5 oDataSet = New DataSet lnStatus = 6 oDataAdapter.Fill(oDataSet, "Temp") lnStatus = 7 ' Record count nCount = oDataSet.Tables("Temp").Rows.Count ' If we have at least one record If nCount > 0 Then oDataView = New DataView oDataView = oDataSet.Tables("Temp").DefaultView End If loConnection.Close() llSuccess = True Catch loError As Exception App.ErrorSetup(loError, "Framework.Data.SQLExec()", lnStatus.ToString) End Try Return llSuccess End Function End ClassIt is when I decided to add a status after each line that I was able to locate the exact place where all those errors were coming from. It was in the line where I fill the dataset. After about two hours, this is when I realized that the connection object should be created in here for the encapsulation purpose.