-
Notifications
You must be signed in to change notification settings - Fork 36
CreateSqlParameter2 Function
DbParameter CreateSqlParameter2(sqlConnectionStringConfigKey:string, parameterName:string, parameterDirection:string, parameterType:string [, parameterSize:integer, parameterValue:object])
Creates a SqlParameter
or OdbcParameter
or DbParameter
object. While this function provides more control over defining a SqlParameter
, the CreateSqlParameter function is expected to be sufficient for most typical need of creating an "Input" parameter.
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 "@".
Possible values for the parameter direction are "Input", "Output", "InputOutput" and "ReturnValue".
Possible values for the parameter type are "Int", "NVarChar", "Bit" or any other SqlDBType or OdbcType or DbType enumeration values. Check Configuring Parameters and Parameter Data Types for a comparison of DbType, SqlDBType and OdbcType
Use CreateSqlParameter or CreateSqlParameter2 function to create parameters for the ExecuteSqlScalar and ExecuteSqlNonQuery functions.
2.17.0414.0
CreateSqlParameter2("AuxDB","@AccountName", "Output", "NVarChar", 20)
CreateSqlParameter2("AuxDB","@EmployeeID", "Output", "Int")
- MIMWAL Site - http://aka.ms/MIMWAL
- MIMWAL Releases - http://aka.ms/MIMWAL/Releases
- MIMWAL Documentation Wiki - http://aka.ms/MIMWAL/Wiki
- MIMWAL FAQ - http://aka.ms/mimwal/faq
- MIMWAL GitHub Code Repo - http://aka.ms/MIMWAL/Repo
- MIMWAL TechNet Q&A Forum (now read-only) - http://aka.ms/MIMWAL/Forum