Dim loDataProvider As Framework.Framework.Data = New Framework.Framework.Data(oApp) ' We have to get the primary key loDataProvider.ParameterAdd("Numero", nRobotPrimaryKey) If Not loDataProvider.SQLExec("SELECT Robot.NoServer,Robot.Run " + _ "FROM Robot " + _ "WHERE Robot.Numero=" + loDataProvider.ParameterAddSQL("Numero")) Then CloseForm() End IfThis code is the first section of code and the first access to the data which is done every minute. So, once loDataProvider.SQLExec() is executed, my loDataProvider is clean.
' SQL exec ' expC1 SQL command Public Function SQLExec(ByVal tcSQL As String) As Boolean Dim lcCharacter As String = "" Dim lcCommandText As String = "" Dim lcField As String = "" Dim lcString As String = "" Dim lcTable As String = "" Dim llSuccess As Boolean = False Dim lnCounter As Integer = 0 Dim lnLocation As Integer = 0 Dim lnLocation2 As Integer = 0 Dim lnOccurence As Integer = 0 Dim lnDateNow As Double = 0 Dim lnDateNow2 As Double = 0 Dim lnElapse As Double = 0 Dim loColumn As DataColumnCollection Dim loDataParameterSQLClient As SqlParameter = Nothing Dim loInsertRow As Framework.InsertRow Dim loObject As Object ' Reset the duration value nDuration = 0 If Not InitializeDataObject(tcSQL) Then Return False End IfThe InitializeDataObject() method, which is where I believe the error occured is simply establishing the connection:
Private Function InitializeDataObject(ByVal tcSql As String) As Boolean Dim lcType As String = "" ' Connection object to be used when we have to open the connection manually Dim loConnection As IDbConnection = Nothing Dim loDataParameterSQLClient As SqlParameter = Nothing Dim loEnumerator As IEnumerator = oParameters.GetEnumerator Dim loParameter As Object oDataAdapter = New SqlDataAdapter oCommand = New SqlCommand oCommand.Connection = oApp.aConnection(nConnectionString, 2)...where oApp.aConnection is the connection which is already opened at the framework level serving all SQL Server requests from the application.