Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Populating OleDbParameterCollection
Message
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Divers
Thread ID:
01080445
Message ID:
01080649
Vues:
12
This message has been marked as the solution to the initial question of the thread.
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.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform