public HowTo_Execute_SQLFunction() { //<document> long _iduser = 0L; OGen.lib.datalayer.DBConnection _con = OGen.lib.datalayer.DBConnectionsupport.CreateInstance( // set your db server type here OGen.lib.datalayer.DBServerTypes.PostgreSQL, // and connectionstring "Server=127.0.0.1;Port=5432;User ID=postgres;Password=passpub;Database=OGen-NTier_UTs;" ); // set your function parameters System.Data.IDbDataParameter[] _dataparameters = new System.Data.IDbDataParameter[] { _con.newDBDataParameter( "IDUser_", System.Data.DbType.Int64, System.Data.ParameterDirection.Input, _iduser, 0 ) }; // call you function _con.Execute_SQLFunction( "sp0_User_delObject", _dataparameters ); _con.Dispose(); _con = null; //</document> }
public HowTo_Execute_SQLFunction_returnSomevalue() { //<document> long _iduser = 0L; OGen.lib.datalayer.DBConnection _con = OGen.lib.datalayer.DBConnectionsupport.CreateInstance( // set your db server type here OGen.lib.datalayer.DBServerTypes.PostgreSQL, // and connectionstring "Server=127.0.0.1;Port=5432;User ID=postgres;Password=passpub;Database=OGen-NTier_UTs;" ); // set your function parameters System.Data.IDbDataParameter[] _dataparameters = new System.Data.IDbDataParameter[] { _con.newDBDataParameter( "IDUser_", System.Data.DbType.Int64, System.Data.ParameterDirection.Input, _iduser, 0 ) }; // call you function and get returning value bool _result = (bool)_con.Execute_SQLFunction( "fnc0_User_isObject", _dataparameters, System.Data.DbType.Boolean, // returning value db type 0 // returning value size, if applicable ); _con.Dispose(); _con = null; //</document> }