IDataTable Interface
GetFieldCount
DeleteField
InsertField
SetFieldSize
GetFieldSize
SetFieldDescription
IDataTable allows modification of field structure in
data table of the model.
To read data from the table use IDIData. To
enter data in the table use IDataMods
interface. IDataTable can be queried from IDataSource.
Query path: Control >GetModel
>IModel > IDataSource
> IDataTable
See also User Data Sample, IDataSource,
IDataMods, IRecordSet
HRESULT
GetFieldCount(int* count)
Parameters
count - [out, retval] The returned current
count of fields in the table
Return Values
- S_OK in case of
success.
DISP_E_PARAMNOTOPTIONAL - if count is a NULL
reference.
Remarks:
Returns the current count of fields in the table.
HRESULT
DeleteField(int field)
Parameters
field - [in]
0-based index of the field to be removed from the table. Must be equal to or
less than the current field count.
DISP_E_BADINDEX - if field is equal to or
greater than the current field count.
Return Values
- S_OK in case of
success.
Remarks:
Deletes the field from the table. All associated data will be lost.
HRESULT InsertField(int field, EDataType type)
Parameters
field - [in]
0-based index of the field to be inserted in the table. Must be equal to or less
than the current field count.
type - [in] member of member of EDataType enumeration
describing the type of the field.
Return Values
- S_OK in case of
success.
DISP_E_BADINDEX - if field is equal to or
greater than the current field count.
Remarks:
Inserts new field of the required type into the table. For existent records
the new field is populated with default values of the type. Existent fields
preserve its data.
HRESULT SetFieldSize(int field, int size)
Parameters
field - [in]
0-based index of the field to be inserted in the table. Must be equal to or less
than the current field count.
size - [in] New field size in bytes
Return Values
- S_OK in case of
success.
DISP_E_BADINDEX - if field is equal to or
greater than the current field count.
DISP_E_PARAMNOTOPTIONAL - if field is
not a string field.
Remarks:
This method is used to set size of a a string field, which is the only type
of field with variable length. Default size of string field is 40 bytes. If field
is not a string field. error DISP_E_PARAMNOTOPTIONAL is returned.
HRESULT GetFieldSize(int field, int* size)
Parameters
field - [in]
0-based index of the field to be inserted in the table. Must be equal to or less
than the current field count.
size - [out, retval] The returned
size of the field
Return Values
- S_OK in case of
success.
DISP_E_BADINDEX - if field is equal to or
greater than the current field count.
DISP_E_PARAMNOTOPTIONAL - if field is not a string field.
Remarks:
This method is used to obtain size of a a string field, which is the only
type of field with variable length. Default size of string field is 40 bytes. If field
is not a string field. error DISP_E_PARAMNOTOPTIONAL is returned.
HRESULT SetFieldDescription(int field, char* description)
Parameters
field - [in]
0-based index of the field to be inserted in the table. Must be equal to or less
than the current field count.
description - [in] Description of the field. There is
no limit on the length of the string.
Return Values
DISP_E_BADINDEX - if field is equal to or
greater than the current field count.
- S_OK in case of
success.
Remarks:
Stores description of the field in the table. There is no limit on the length
of the string.
|