Adding Parameters to Access Queries

by Admin 6. October 2009 21:31

Option 1:

Create a Parameter object and add this to an existing Command object.

'Create a new parameter

Dim myParam As New OleDbParameter("ParamName", paramValue)

'add the parameter to the command

cmd.Parameters.Add(myParam)

Option 2:

Use the AddWithValue option to add a Parameter directly to the Command object.

'create, assign value and add a new parameter to the command

cmd.Parameters.AddWithValue("ParamName", paramValue)

 

Tags: , ,

Access