Skip to content

CreateSqlParameter Function

NileshGhodekar edited this page Mar 18, 2018 · 5 revisions

Syntax

DbParameter CreateSqlParameter(sqlConnectionStringConfigKey:string, parameterName:string, parameterValue:object [, parameterDirection:string])

Description

Creates a SqlParameter or OdbcParameter or DbParameter object.

Remarks

To use this function, first define a Connection String in the FIMService application config file (Microsoft.ResourceManagement.Service.exe.config) and restart the FIMService. Only Native SQL Server and ODBC .Net Framework data providers are supported. An example of Native SQL Server and ODBC connection strings is listed below:

<configuration>
   <connectionStrings>
    <add name="AuxDB" connectionString="Data Source=IDSYS.CONTOSO.COM;Initial Catalog=FIMAuxiliaryDB;Integrated Security=SSPI;" providerName="System.Data.SqlClient" />

    <add name="AuxDB_ODBC" connectionString="DRIVER={SQL Server Native Client 11.0};SERVER=IDSYS.CONTOSO.COM;DATABASE=FIMAuxiliaryDB;Trusted_Connection=Yes;APP=MIMWAL;" providerName="System.Data.Odbc" />
  </connectionStrings>
</configuration>

If the connection strings contain SQL User's password, it is highly recommended that you do not leave them unencrypted. The connection strings section can be encrypted using the helper script EncryptConnectionString.ps1 included in the project source code.

The parameter names must start with an "@".

If the optional direction parameter is omitted, the direction is assumed to be "Input". Possible values for the parameter direction are "Input", "Output", "InputOutput" and "ReturnValue".

Use CreateSqlParameter or CreateSqlParameter2 function to create parameters for the ExecuteSqlScalar and ExecuteSqlNonQuery functions.

Supported Version

2.17.0414.0

Examples

CreateSqlParameter("AuxDB","@FirstName", [//Target/FirstName])

CreateSqlParameter("AuxDB","@UniquenessKey", [//Value])

Clone this wiki locally