1. Script object OG.SQL

    Article: AN0002193Updated: 21.09.2018

    This object offers functions for work with the database by means of SQL commands.

    Script functions

    Name Description
    void RunSql(string sql) Function runs the entered SQL command in the database.
    void RunSql(IDbTransaction trans, string sql, SqlParameterList pars) Function runs the entered SQL command in the database.
    object RunScalarSql(string sql) Function returns value of the first row and first column. It is suitable for SQL commands returning summary data.
    object RunScalarSql(IDbTransaction trans, string sql, SqlParameterList pars) Function returns value of the first row and first column. It is suitable for SQL commands returning summary data.
    StringCollection GetStringList(string sql, string parameterName, SqlParameterList pars) Function returns list of texts according to the column parameterName.
    List GetIntegerList(IDbTransaction trans, string sql, string parameterName, SqlParameterList pars) Function returns list of numeric values according to the columnparameterName.
    TypeDataReader GetExecuteReader(IDbTransaction trans, string sql, SqlParameterList pars) Function returns type DataReader. After that you can read records from the database and process the according to your needs.
    SqlParameterList CreateParameterList() Function returns object for parameter definition. You will use this object for functions RunSql, RunScalarSql...

    Object call

    OG.Sql

    Example of call

    var ii = OG.Sql.RunScalarSql( 'select ii from mytable');
    OG.Log.Write( 'ii: ' + ii.ToString());

×