Please ensure Javascript is enabled for purposes of website accessibility
Powered by Zoomin Software. For more details please contactZoomin

Application Server

SetParam type methods for SQL Server and Oracle

  • Last UpdatedJul 22, 2024
  • 1 minute read

Frequently, the SQL statement that you use to create a command has parameters encoded in it. In such cases, you must set values for all parameters needed as input by the SQL statement before you run the command.

For SQL Server databases, parameters are indicated by @<ParameterName> so that each parameter is named. The following method call accommodates named parameters:

Set<Type>ParameterByName()

You must use the version of the method that matches the way that you created your connection object. When you create a connection object with aaDBConnectionTypeOleDb, you must use the method Set<Type>ParameterByIndex(). For all other connections, use the method Set<Type>ParameterByName().

Parameters are usually mapped to a table column, which always has a specific type. The method properties that you must supply with each of the methods in this subsection depend on the column type that they map to.

Separate methods are necessary because different column types require that you specify different method parameters.

For example, a column of type NVarChar requires a length be specified while a column type of Decimal requires precision and scale.

The method parameters that are common across all methods are:

  • Parameter Name (parameterName)

  • Parameter Value (parameterValue)

You can specify null for parameterValue when the Parameter Direction is Output or ReturnValue.

Parameter Direction (parameterDirection) enumerated values are:

  • Input

  • InputOutput

  • Output

  • ReturnValue

TitleResults for “How to create a CRG?”Also Available in