Step 9: Get the desired record from the cursor (table)

<< Click to Display Table of Contents >>

Navigation:  Application development > Introduction to BDE programming > BDE Programming in C++Builder > Basic procedure >

Step 9: Get the desired record from the cursor (table)

Previous pageReturn to chapter overviewNext page

After creating the record buffer and positioning the cursor’s record pointer, read one record’s data into the memory buffer using the function DbiGetNextRecord.

When calling DbiGetNextRecord, specify the source cursor with the variable hCur that was set in a previous step (for DbiOpenTable). Indicate the lock type for the record access in the eLock argument for DbiGetNextRecord. Here, the constant dbiNOLOCK is used to access the record without locking it. Specify the record buffer as the pRecBuc argument. This example’s record buffer was created in step 7. No optional record properties are used in this example, so NULL is passed for the precProps argument. On executing, DbiGetNextRecord makes that next record the current one.

Check(DbiGetNextRecord(

 hCur,      // Cursor from which to get the record

 dbiNOLOCK, // Lock type

 pRecBuf,   // Memory buffer to store the record

 NULL));    // Optional record properties