Private oParameters As New ArrayList Private oParameters2 As New CollectionEach parameter is added by using this method into oParameters. Then,
' Add a parameter ' expC1 Field ' expO1 Value Public Function ParameterAdd(ByVal tcField As String, ByVal toValue As Object) As Boolean Dim loParameter(1, 2) As Object loParameter(1, 1) = tcField loParameter(1, 2) = toValue oParameters.Add(loParameter) End FunctionThen, before each SQL method from the class, this method is called to set the proper type of connection, dataadapter, command and parameters. This is where oParameters2 is then initialized accordingly to the type of connection string used.
Private Function InitializeDataObject(ByVal tcConnection As String, ByVal tcSql As String) As IDbConnection Dim loEnumerator As IEnumerator = oParameters.GetEnumerator Dim loParameter As Object cConnectionString = tcConnection cSQL = tcSql oParameters2.Clear() Select Case nSQLMode Case 1 oConnection = New OleDbConnection(tcConnection) oDataAdapter = New OleDbDataAdapter oCommand = New OleDbCommand While loEnumerator.MoveNext loParameter = loEnumerator.Current oDataParameter = New OleDbParameter("@" + loParameter(1, 1).ToString, loParameter(1, 2)) oParameters2.Add(oDataParameter) End While Case 2 oConnection = New SqlConnection(tcConnection)>But, IAC, since the SELECT doesn't make use of parameters in this instance then an invalid parameter collection shouldn't cause the error.