Parameters

Parameters are not only useful when you are working with Stored Procedures.


Creating a Parameter Object

There are several different ways you can create a Parameter object but the most transparent way is to use the Parameter properties.


Dim objCommand As New System.Data.OleDb.OleDbCommand 
Dim objParameter As New System.Data.OleDb.OleDbParameter()

sSQLQuery = "SELECT * FROM Clients WHERE ClientID=@ClientID"

objCommand.Connection = mobjDataConnection
objCommand.CommandText = sSQLQuery

objParameter.ParameterName = "ClientID"
objParameter.OleDbType = System.Data.OleDb.OleDbType.Char
objParameter.SourceColumn = ""
objParameter.Size = 0

objCommand.Parameters.Add(objParameter)


© 2022 Better Solutions Limited. All Rights Reserved. © 2022 Better Solutions Limited TopPrevNext