>I've just read through the thread to date. The problem does seem to be that you are somehow (*sometimes*) using a connection referenced at the global level (given that you have no shared properties).
>
>And if that is true then it is possible that Steven's suggestion as to the cause of the SQL errors is valid - if when you open a connection you then set the environment another hit that references the same connection might use it before that setup is complete.
>
>Are the connections always created by your oProcess object? Are there *any* references to connections held in or referenced from oApp?
>
>As a debug exercise you might add a GUID property to your connection class and log this before some of the offending error lines. This should enable you to check whether different hits were actually accessing the same connection and, if so, might also provide a clue as to where this was happening...?
The connection strings are set in the framework application initialization sequence. So, I always refer them as:
oApp.aConnection(1)
for example.
As I don't want to read my INI file at every hit, I read it at the application initialization time. Does this mean I will have to read the INI file at every hit just so to avoid this problems?
But, this is only for the connection strings. The connection object itself is done when I create an instance of the data provider class. So, I really don't see how this could be a problem here. The top of my data class is as follow:
Namespace Framework
Public Class Data
Public cSQL As String = ""
Public cConnectionString As String = ""
Public nCount As Integer = 0
Public nNoMember As Integer = 0
Public nPrimaryKey As Integer = 0
Public nSQLMode As Integer = 1
Public oApp As Framework.App
Public oDataSet As DataSet
Public oDataTable As DataTable
Public oDataView As DataView
Public oProcess As Framework.LXProcess
Private cSQLParse As String = ""
Private oCommand As IDbCommand = Nothing
Private oCommandText As New Collection
Private oConnection As IDbConnection = Nothing
Private oDataAdapter As IDbDataAdapter = Nothing
Private oDataParameter As IDbDataParameter = Nothing
Private oDataReader As IDataReader = Nothing
Private oParameters As New ArrayList
Private oParameters2 As New Collection
The class contains a property oConnection. It is initialized at every method call. So, the connection object is only used every time a call is done to SQLExec(), SQLUpdate() or SQLInsert() for example.