CPDB.Net

https://cpdb.ppcompiler.org/

2- Open and close databases (CPDB library)




Introduction

Before browse and read a CPDB database, you must open it. And by the way, after browse and read a CPDB database, you must close it...

Waring : you can open 100 databases at a time, for all CPDB applications, so if you open 10 databases, 90 databases handles are available for other applications.

You can open the same database more than one time. With this feature it's possible to browse the same database on different ways at the same time.

Note : all CPDB function return an error code. This code is 0 if no error occured. You can find error codes values in the CPDB errors index.


Open a CPDB database


Use the following example :

Err err;

UInt8 mydbHandle;
err = CPDB_Open(0, "mydb", dmModeReadWrite, &mydbHandle);


Parameters :



  1. The card number where the database reside on, use 0.
  2. The name of the database, depend of the name you give to the database.
  3. The opening mode : use dmModeReadWrite if you want to use Sort feature, if not, use dmModeReadOnly.
  4. The CPDB_Open write the handle of the database in a UInt8 value. Use this handle in all the fonction using the opened database.

Close a CPDB database


Use the following example :
err = CPDB_Close(mydbHandle);

The parameter is the handle obtained by the CPDB_Open operation.


More information

CPDB_Open

CPDB_Close

CPDB_DatabaseExist