Esempio n. 1
0
        public void HowTo()
        {
//<document>
            long _iduser = 1L;

            OGen.Libraries.DataLayer.DBConnection _con
                = OGen.Libraries.DataLayer.DBConnectionsupport.CreateInstance(
                      // set your db server type here
                      OGen.Libraries.DataLayer.DBServerTypes.PostgreSQL,
                      // and connectionstring
                      "Server=127.0.0.1;Port=5432;User ID=postgres;Password=passpub;Database=KickUnitTests;"
                      );

// 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_CRD_User_isObject",
                _dataparameters,
                System.Data.DbType.Boolean, // returning value db type
                0                           // returning value size, if applicable
                );

            _con.Dispose(); _con = null;
//</document>

            // the only porpuses is to keep documentation code samples updated by:
            // 1) ensure documentation code samples are compiling
            // 2) no exceptions are beeing thrown by documentation code samples
            Assert.IsTrue(
                true,
                "documentation code sample is failing"
                );
        }
Esempio n. 2
0
        public void HowTo()
        {
//<document>
            long _iduser_search = 1L;

            OGen.Libraries.DataLayer.DBConnection _con
                = OGen.Libraries.DataLayer.DBConnectionsupport.CreateInstance(
                      // set your db server type here
                      OGen.Libraries.DataLayer.DBServerTypes.PostgreSQL,
                      // and connectionstring
                      "Server=127.0.0.1;Port=5432;User ID=postgres;Password=passpub;Database=KickUnitTests;"
                      );

// set your function parameters
            System.Data.IDbDataParameter[] _dataparameters
                = new System.Data.IDbDataParameter[] {
                _con.newDBDataParameter(
                    "IDUser_search_",
                    System.Data.DbType.Int64,
                    System.Data.ParameterDirection.Input,
                    _iduser_search,
                    0
                    )
                };

// you now have a DataTable populated
// with results from your sql function
            System.Data.DataTable _datatable
                = _con.Execute_SQLFunction_returnDataTable(
                      "sp0_CRD_UserProfile_Record_open_byUser",
                      _dataparameters
                      );

            _con.Dispose(); _con = null;
//</document>

            // the only porpuses is to keep documentation code samples updated by:
            // 1) ensure documentation code samples are compiling
            // 2) no exceptions are beeing thrown by documentation code samples
            Assert.IsTrue(
                true,
                "documentation code sample is failing"
                );
        }