العودة إلى  مدرسة الكمبيوتر   قسم البرمجة    الصفحة الأولى

CdbProperty Object

A CdbProperty object represents a built-in or user-defined characteristic of a DAO object.

Remarks

Every DAO object, except the CdbConnection and CdbError objects, contains a Properties collection, which has CdbProperty objects corresponding to built-in properties of that DAO object. The user can also define CdbProperty objects and append them to the Properties collection of some DAO objects. These CdbProperty objects (which are often just called properties) uniquely characterize that instance of the object.

You can create user-defined properties for the following objects:

  • CdbDatabase, CdbIndex, CdbQueryDef, and CdbTableDef objects.

  • CdbField objects in Fields collections of CdbQueryDef and CdbTableDef objects.

To add a user-defined property, use the CreateProperty method to create a CdbProperty object with a unique Name property setting. Set the Type and Value properties of the new CdbProperty object, and then append it to the Properties collection of the appropriate object. The object to which you are adding the user-defined property must already be appended to a collection. Referencing a user-defined CdbProperty object that has not yet been appended to a Properties collection will cause an error, as will appending a user-defined CdbProperty object to a Properties collection containing a CdbProperty object of the same name.

You can delete user-defined properties from the Properties collection, but you can't delete built-in properties.

Note A user-defined CdbProperty object is associated only with the specific instance of an object. The property isn't defined for all instances of objects of the selected type.

You can use the Properties collection of an object to enumerate the object's built-in and user-defined properties. You don't need to know beforehand exactly which properties exist or what their characteristics (Name and Type properties) are to manipulate them. However, if you try to read a write-only property, such as the Password property of a CdbWorkspace object, or try to read or write a property in an inappropriate context, such as the Value property setting of a CdbField object in the Fields collection of a CdbTableDef object, an error occurs.

The CdbProperty object also has four built-in properties:

  • The Name property — a String that uniquely identifies the property.

  • The Type property — an Integer that specifies the property data type.

  • The Value property — a Variant that contains the property setting.

  • The Inherited property — a Boolean that indicates whether the property is inherited from another object. For example, a CdbField object in a Fields collection of a CdbRecordset object can inherit properties from the underlying CdbTableDef or CdbQueryDef object.

To refer to a built-in CdbProperty object in a collection by its ordinal number or by its Name property setting, use either of the following syntax forms:

Properties[0]

Properties["name"]

For a built-in property, you can also use this syntax:

object.name

Note For a user-defined property, you must use the Properties["name"] syntax.

With the same syntax forms, you can also refer to the Value property of a CdbProperty object. The context of the reference will determine whether you are referring to the CdbProperty object itself or the Value property of the CdbProperty object.

CdbProperty Constructor Syntax

Use any one of the following three constructors. The qualifier 'CONSTRUCTOR' in the syntax models is provided to help readability. It has no syntactic value.

CONSTRUCTORCdbProperty(VOID);

This constructor creates an instance of the class. There are no parameters.

CONSTRUCTORCdbProperty(const CdbProperty &);

Type

Description

const CdbProperty &

Reference to an object.

 

This constructor creates a copy of the object referenced in the parameter.

CONSTRUCTORCdbProperty(DAOProperty *pprp,

BOOL bAddRef = FALSE);

Type

Argument

Description

DAOProperty *

pprp

A DAO Automation interface pointer corresponding to this DAO class.

BOOL

bAddRef

=FALSE

Optional. A Boolean. If TRUE, the DAO Automation interface AddRef function is called.

 

DAO functionality is presented through pointers to DAO Automation interfaces. This constructor makes a DAO interface available in the form of a DAO class object that provides additional functionality.

This constructor is not required for typical use. It is provided to enable you to easily create a DAO class object if you have access to the corresponding DAO interface.

When the destructor for the DAO object is invoked, the underlying Automation interface's Release member is called. If Release decrements the interface's reference count to zero, the pointer to the Automation interface can be deleted. If you don't want this to happen (for example, because you want to discard the DAO object, but continue using the Automation interface), specify TRUE for the second parameter. The underlying Automation interface's AddRef member is called, which counterbalances the eventual call to Release.

 

 طباعة المقال العودة إلى  مدرسة الكمبيوتر   قسم البرمجة    الصفحة الأولى
Syria
سورية
Amrit
عمريت
أرواد
طرطوس
صور من طرطوس
صور من سورية
للسيدات فقط
معجم الكمبيوتر
أدب وفكر
المجلة الطبية
المعلومات العامة
لمحة عن طرطوس
الموضة النسائية
مدرسة الكمبيوتر
 © 2002-2012 LBCInformation Corporation. All rights reserved م حنا عطا لحود.