3.4 Выполнение SQL функции

5 мая 2025 г.

12:03

Using reader = runner.SqlExecute("QER_FGIPWOOrderPerson", {

QueryParameter.Create("@uidperson", strUID_Person),

QueryParameter.Create("@uidaccproduct", UID_AccProduct)})

While reader.Read()

EmpCanOrderProduct = reader.GetString(0)

End While

End Using


Steps to provide a Predefined SQL statement

  1. Create a predefined SQL statement in the Designer that is using the SP

  1. Assign a permission group to the predefined SQL statement that is allowed to use it

  1. Use the predefined SQL statement in your DialogScript
    Dim runner = Session.Resolve(Of VI.DB.DataAccess.IStatementRunner)()
    Using reader = runner.SqlExecute("CCC_getUser", {QueryParameter.Create("accountID", 42)})
        While reader.Read()
            ' Do normal IDataReader stuff here
        End While
    End Using

You can access the columns in the reader using either the index or the name of the column as described here  https://docs.microsoft.com/en-us/dotnet/framework/data/adonet/retrieving-data-using-a-datareader (or in several other online articles around accessing data using DataReader).

For example:

reader.GetString(0)

reader.GetInt32(1)

reader("columnname").ToString()

* *

Run a SQL query with parameter from script called via api - Forum - Identity Manager Community - One Identity Community