Michel
Here's the code you are looking for. You cannot instantiate an OleDBParameterCollection but you can instantiate a Collection object.
The sample call is below...
Imports System.Data.OleDb
Public Class Library2
Public oParameters As New Collection
Public Function SQLExecCommand(ByVal cSQL As String) As OleDbCommand
Dim ExecCmd As New OleDbCommand
ExecCmd.Connection = Library.GetConnectionObject
ExecCmd.CommandText = cSQL
Dim oParam As OleDbParameter
For Each oParam In oParameters
ExecCmd.Parameters.Add(oParam)
Next
Return ExecCmd
End Function
End Class
Sample call
Public Shared Function GetOrdersByEmployeeAndCustomer(ByVal EmployeeID As Integer, ByVal CustomerId As String) As DataSet
Dim oLib As New Library2
oLib.oParameters.Add(New OleDbParameter("@EmployeeID", EmployeeID))
oLib.oParameters.Add(New OleDbParameter("@CustomerID", CustomerId))
Dim FoxCMD As OleDbCommand = oLib.SQLExecCommand("Select * From orders where employeeID = ? and CustomerID = ? ")
Dim FoxAdapter As New OleDbDataAdapter
FoxAdapter.SelectCommand = FoxCMD
Dim ReturnData As New DataSet
FoxAdapter.Fill(ReturnData, "orders")
FoxCMD.Connection.Close()
Return ReturnData
End Function
Rod Paddock
Editor in Chief CoDe Magazine
President Dash Point Software, Inc.
VP Red Matrix Technologies,Inc.