|
<< Click to Display Table of Contents >> Step 5: Open a table, creating a cursor object |
![]() ![]()
|
Now you can open the table.
Upon opening a table, a cursor object is created and returned to the calling application. A cursor object is an abstraction that lets you access queries and tables in the same method:
hDBICur hCur = 0; // Handle to the cursor (table)
CHAR szTblName[DBIMAXNAMELEN];
// Table name - DBIMAXNAMELEN is defined in IDAPI.H
CHAR szTblType[DBIMAXNAMELEN];
// Table Type
strcpy(szTblName, "customer");
// Name of the table
strcpy(szTblType, szPARADOX);
// Type of the tables - szPARADOX is defined in IDAPI.H
Chk(DbiOpenTable(
hDb, // Handle to the standard database
szTblName, // Name of the table
szTblType, // Type of the table - only used for local tables
NULL, // Index Name - Optional
NULL, // IndexTagName - Optional. Only used by dBASE
0, // IndexId - 0 = Primary.
dbiREADWRITE, // Open Mode - Read/Write or Read Only
dbiOPENSHARED, // Shared mode - SHARED or EXCL
xltFIELD, // Translate mode - Almost always xltFIELD
FALSE, // Unidirectional cursor movement.
NULL, // Optional parameters.
&hCur)); // Handle to the cursor