Column object

The Column object allows you to define the fields contained in a table or a key. The Columns collection contains all of the columns for a key or a table.

Creating a new column

Use the Append method to create a new column and automatically add the column to the Columns collection. To set the data type of a column, specify a constant contained in the DataTypeEnum enumeration.

{Append a column named "Date" with a date data type.}
tableColumn = adoxTable.Columns.Append("Date", ADOX.adDate);

The following table lists the Dexterity data types and the corresponding ADOX types.

[spacer]

Dexterity type

ADOX type

Description

Boolean

adBoolean

Boolean

Byte

adUnsignedTinyInt

Unsigned character

Integer

adSmallInt

Short

Long

adInteger

Long

String

Text

adWChar

adVarWChar

String

Currency

adCurrency

Currency

Vcurrency

adSingle

adDouble

adDecimal

Single

Double

Decimal

Date

Time

Datetime

adDBDate

adDBTime

adDBDateStamp

Date

Reference

adDispatch (unsupported)

IDispatch*

A typed COM reference

adUnknown (unsupported)

IUnknown*


When you create a table, create the table columns before you create key columns. The columns in a key must also be in the table that the key is associated with.

Retrieving an existing column

You can retrieve an existing column from the Columns collection with the Item property by the number associated with the column.

{Retrieve the first column from the table.}
tableColumn = adoxTable.Columns.Item[0];

You can also access columns by the column name.

{Retrieve the column named "BuyerID".}
tableColumn = adoxTable.Columns.Item["BuyerID"]


Documentation Feedback