Product Documentation

c-treeDB API for C++ - Developers Guide

Previous Topic

Next Topic

Deleting Resources

The following steps are required to delete a resource from a table:

  1. Instantiate a CTResource object by calling one of the CTResource constructors. You should pass at least the resource type and number. The resource name is optional. If you use a CTResource constructor that does not take the resource type and number, you need to call CTResource::SetType() and CTResource::SetNumber() to set the resource type and number before you add a new resource.
  2. Call CTResource::Delete() method to delete the resource
  3. Once the CTResource object is no longer needed, destroy the object to release any system resources.

A resource can be deleted from a table by calling the following CTResource class method:

void CTResource::Delete();

Example

void DelMyResource(const CTTable& hTable, ULONG type, ULONG number)

{

CTResource* hRes = new CTResource(hTable, type, number);

try

{

hRes->Delete();

}

catch (CTException &err)

{

printf("Error %d - %s\n", err.GetErrorCode(), err.GetErrorMsg());

}

delete hRes;

}

TOCIndex