|
<< Click to Display Table of Contents >> C Examples: DbiBatchMove |
![]() ![]()
|
Create and copy table information from a dBASE or FoxPro table to a Paradox table.
Source table must be a dBASE or FoxPro table. This example uses the following input:
fDbiBatchMove(hDb, &hPXCur, hdBASECur);
DBIResult fDbiBatchMove(hDBIDb hTmpDb, phDBICur phDestCur, hDBICur hSrcCur)
{
DBIResult rslt;
CURProps CurProps;
BATTblDesc TblDesc;
// Get source cursor properties
rslt = Chk(DbiGetCursorProps(hSrcCur, &CurProps));
if (rslt != DBIERR_NONE)
return rslt;
TblDesc.hDb = hTmpDb;
strcpy(TblDesc.szTblName, CurProps.szName);
strcpy(TblDesc.szTblType, szPARADOX);
// Delete table if it exists
rslt = DbiDeleteTable(hTmpDb, CurProps.szName, szPARADOX);
if ((rslt != DBIERR_NOSUCHFILE) && (rslt != DBIERR_NOSUCHTABLE))
Chk(rslt);
// Copy the information from the dBASE table to the Paradox table
rslt = Chk(DbiBatchMove(NULL, hSrcCur, &TblDesc, NULL, batCOPY,
0, 0, NULL, NULL, NULL, "KEYVIOL", "PROBLEMS", "CHANGED",
NULL, NULL, NULL, FALSE, FALSE, NULL, FALSE));
if (rslt != DBIERR_NONE)
return rslt;
// Open the newly created Paradox table
rslt = Chk(DbiOpenTable(hTmpDb, CurProps.szName, szPARADOX, NULL, NULL, 0,
dbiREADWRITE, dbiOPENSHARED, xltFIELD, FALSE, NULL, phDestCur));
return rslt;
}