Init
First we need to open a connection to a database by providing the c-treeACE Database Engine with a user name, password and the database name. Below is the code for Initialize(): // // Initialize() // // Perform the minimum requirement of logging onto the c-tree Server // VOID Initialize(VOID) {
printf("INIT\n");
// allocate the session object MySession = new CTSession(CTSESSION_CTREE); // allocate the table objects tableCustMast = new CTTable(MySession); tableCustOrdr = new CTTable(MySession); tableOrdrItem = new CTTable(MySession); tableItemMast = new CTTable(MySession); // allocate the record objects recordCustMast = new CTRecord(tableCustMast); recordCustOrdr = new CTRecord(tableCustOrdr); recordOrdrItem = new CTRecord(tableOrdrItem); recordItemMast = new CTRecord(tableItemMast); try {
// connect to server printf("\tLogon to server...\n");
MySession->Logon("FAIRCOMS", "", "");
} catch (CTException E) {
Handle_Exception(E); } } |
|||