Imports System.Data Imports System.Data.Common Imports System.Data.OleDb Imports System.Data.SqlClient Imports System.Data.Odbc Public Class Data Public oDataSet As DataSet Public oDataView As DataView Public cSQL As String Public cConnectionString As String Public nCount As Integer Public nSQLMode As Integer = Framework.App.nSQLMode Private oConnection As IDbConnection = Nothing Private oDataAdapter As IDbDataAdapter = Nothing Private oCommand As IDbCommand = Nothing Private oDataParameter As IDbDataParameter = Nothing Private oParameters(25, 2) As Object Private oParameters2 As New Collection Private nParameter As Integer = 0 ' SQL exec ' expC1 SQL command ' expO1 Connection Public Function SQLExec(ByVal tcSQL As String, ByVal tcConnection As String) As Boolean InitializeDataObject(nSQLMode, tcConnection, tcSQL) . . . Public Function InitializeDataObject(ByVal tnConnType As Integer, ByVal tcConnection As String, _ ByVal tcSql As String) As IDbConnection Dim lnCounter As Integer cConnectionString = tcConnection cSQL = tcSql Select Case tnConnType Case 1 oConnection = New OleDbConnection(tcConnection) oDataAdapter = New OleDbDataAdapter oCommand = New OleDbCommand oDataParameter = New OleDbParameter For lnCounter = 1 To nParameter oParameters2.Add(New OleDbParameter(oParameters(lnCounter, 1).ToString, oParameters(lnCounter, 2))) Next Case 2 oConnection = New SqlConnection(tcConnection) oDataAdapter = New SqlDataAdapter oCommand = New SqlCommand oDataParameter = New SqlParameter For lnCounter = 1 To nParameter oParameters2.Add(New SqlParameter(oParameters(lnCounter, 1).ToString, oParameters(lnCounter, 2))) Next Case 3 oConnection = New OdbcConnection(tcConnection) oDataAdapter = New OdbcDataAdapter oCommand = New OdbcCommand oDataParameter = New OdbcParameter For lnCounter = 1 To nParameter oParameters2.Add(New OdbcParameter(oParameters(lnCounter, 1).ToString, oParameters(lnCounter, 2))) Next End Select Return oConnection End Function ' Add a parameter ' expC1 Field ' expO1 Value Public Function ParameterAdd(ByVal tcField As String, ByVal toValue As Object) As Boolean nParameter = nParameter + 1 oParameters(nParameter, 1) = "@" + tcField oParameters(nParameter, 2) = toValue End Function ' Clear the parameter ' This is needed is you are doing multiple loDataProvider SQL calls in a row such as a SQLExec() ' followed by a SQLUpdate() and you have defined a parameter for the SQLExec() that you don't need ' for the SQLUpdate(). Public Function ParameterClear() As Boolean Dim lnCounter As Integer For lnCounter = 1 To nParameter oParameters(lnCounter, 1) = "" oParameters(lnCounter, 2) = "" Next nParameter = 0 oParameters2.Clear() End Function End ClassSo, in order to isolate the addition of parameters from the interface, I created a ParameterAdd() method in the class. So, if I enhance that, I won't have to worry about the interface. So, as you can see, I add each parameter in an array object. Then, when I know the data adapter, I read from that array into the collection. That collection can then be used in SQLExec(), SQLUpdate(), SQLInsert() and SQLDelete() methods to be added as parameters into the command object.