コード例 #1
0
ファイル: Tutorial3.cs プロジェクト: WooZoo86/ctree
        //
        // Initialize()
        //
        // Perform the minimum requirement of logging onto the c-tree Server
        //

        static void Initialize()
        {
            Console.WriteLine("INIT");

            try
            {
                // allocate objects
                MySession = new CTSession(SESSION_TYPE.CTREE_SESSION);
                MyTable   = new CTTable(MySession);
                MyRecord  = new CTRecord(MyTable);
            }
            catch (CTException E)
            {
                Handle_Exception(E);
            }

            try
            {
                // connect to server
                Console.WriteLine("\tLogon to server...");
                MySession.Logon("FAIRCOMS", "ADMIN", "ADMIN");
            }
            catch (CTException E)
            {
                Handle_Exception(E);
            }
        }
コード例 #2
0
        //
        // Check_Table_Mode()
        //
        // Check if existing table has transaction processing flag enabled.
        // If a table is under transaction processing control, modify the
        // table mode to disable transaction processing
        //

        static void Check_Table_Mode(CTTable table)
        {
            try
            {
                // get table create mode
                CREATE_MODE mode = table.GetCreateMode();

                // check if table is under transaction processing control
                if ((mode & CREATE_MODE.TRNLOG_CREATE) != 0)
                {
                    // change file mode to disable transaction processing
                    mode ^= CREATE_MODE.TRNLOG_CREATE;
                    table.UpdateCreateMode(mode);
                }
            }
            catch (CTException E)
            {
                Handle_Exception(E);
            }
        }
コード例 #3
0
        //
        // Initialize()
        //
        // Perform the minimum requirement of logging onto the c-tree Server
        //

        static void Initialize()
        {
            Console.WriteLine("INIT");

            try
            {
                // This section is only needed for the AppServer DLL model.
                bool AppServerModel = true;
                if (AppServerModel)
                {
                    // Set c-tree database engine configuration file name.
                    CTSession.SetConfigurationFile("ctsrvr.cfg");
                    // Start c-tree database engine.
                    CTSession.StartDatabaseEngine();
                }


                // allocate objects
                MySession = new CTSession(SESSION_TYPE.CTREE_SESSION);
                MyTable   = new CTTable(MySession);
                MyRecord  = new CTRecord(MyTable);
            }
            catch (CTException E)
            {
                Handle_Exception(E);
            }

            try
            {
                // connect to server
                Console.WriteLine("\tLogon to server...");
                MySession.Logon("FAIRCOMS", "ADMIN", "ADMIN");
            }
            catch (CTException E)
            {
                Handle_Exception(E);
            }
        }
コード例 #4
0
        //
        // Initialize()
        //
        // Perform the minimum requirement of logging onto the c-tree Server
        //

        static void Initialize()
        {
            Console.WriteLine("INIT");

            try
            {
                // allocate the session object
                MySession = new CTSession(SESSION_TYPE.CTREE_SESSION);

                // allocate the table objects
                tableCustOrdr = new CTTable(MySession);
                tableOrdrItem = new CTTable(MySession);
                tableItemMast = new CTTable(MySession);
                tableCustMast = new CTTable(MySession);

                // allocate the record objects
                recordCustOrdr = new CTRecord(tableCustOrdr);
                recordOrdrItem = new CTRecord(tableOrdrItem);
                recordItemMast = new CTRecord(tableItemMast);
                recordCustMast = new CTRecord(tableCustMast);
            }
            catch (CTException E)
            {
                Handle_Exception(E);
            }

            try
            {
                // connect to server
                Console.WriteLine("\tLogon to server...");
                MySession.Logon("FAIRCOMS", "ADMIN", "ADMIN");
            }
            catch (CTException E)
            {
                Handle_Exception(E);
            }
        }