SoFunction
Updated on 2025-04-11

Chinese help details chm documentation


3. Create an index example
The following code demonstrates how to create a new index. The index is created for two columns of the table.

Sub CreateIndex()

        Dim tbl As New Table
        Dim idx As New 
        Dim cat As New 

' Open the directory.
'Open the directory.
         = _
           ""Provider=.4.0;"" & _
           ""Data Source=c:\Program Files\Microsoft Office\"" & _
           ""Office\Samples\;""

'Define the table and append it to the directory
         = ""MyTable""
         ""Column1"", adInteger
         ""Column2"", adInteger
         ""Column3"", adVarWChar, 50
         tbl

'Define multiple column indexes
         = ""multicolidx""
         ""Column1""
         ""Column2""

Append the index to the table
         idx

End Sub
4. Create keyword examples
The following code demonstrates how to create new external keywords. Assume that there are already two tables (Customers and Orders).

Sub CreateKey()

        Dim kyForeign As New 
        Dim cat As New 

         = ""Provider=.4.0;"" & _
           ""Data Source=c:\Program Files\Microsoft Office\"" & _
           ""Office\Samples\;""

         = ""CustOrder""
         = adKeyForeign
         = ""Customers""
         ""CustomerId""
        (""CustomerId"").RelatedColumn = ""CustomerId""
         = adRICascade
        (""Orders""). kyForeign
End Sub
       [/code]

 

Type    Properties (Columns)


Indicates the column's data type

Set and return value

Set or return a long integer value, which is one of the following constants:

Constant Description
adTinyInt   Exact numerical value, with accuracy of 3 digits after the decimal point. For more information about this type, please refer to "OLE   DB    Programmer Reference".
AdSmallInt   Accurate numerical value, with accuracy of 5    decimal point. For more information about this type, please refer to "OLE   DB    Programmer Reference".
AdInteger   Exact numerical value, with accuracy of 10 digits after the decimal point. For more information about this type, please refer to "OLE   DB    Programmer Reference".
AdBigInt   Exact numerical value, with accuracy of 19    decimal point. For more information about this type, please refer to "OLE   DB    Programmer Reference".
AdUnsignedTinyInt   Unsigned   adTinyInt.
AdUnsignedSmallInt   Unsigned   adSmallInt.
AdUnsignedInt   Unsigned   adInteger.
AdUnsignedBigInt   Unsigned   adBigInt.
AdSingle  Single precision floating point number.
AdDouble   Double precision floating point number.
AdCurrency    Currency type. For more information about this type, please refer to "OLE   DB    Programmer Reference".
AdDecimal   Variable type decimal type. For more information about this type, please refer to "OLE   DB    Programmer Reference".
AdNumeric   Numeric Value Type. For more information about this type, please refer to "OLE   DB    Programmer Reference".
AdBoolean   Variation Boolean type. 0   For falsehood    ~0   For true.
AdUserDefined   User-defined variable length data type. For more information about this type, please refer to "OLE   DB    Programmer Reference".
AdVariant   Automatic variant. For more information about this type, please refer to "OLE   DB    Programmer Reference".
AdGuid   A domain unique identifier. For more information about this type, please refer to "OLE   DB    Programmer Reference".
AdDate   Auto date. For more information about this type, please refer to "OLE   DB    Programmer Reference".
AdDBDate   Database date data structure. For more information about this type, please refer to "OLE   DB    Programmer Reference".
AdDBTime   Database time data structure. For more information about this type, please refer to "OLE   DB    Programmer Reference".
AdDBTimestamp   Database timestamp structure. For more information about this type, please refer to "OLE   DB    Programmer Reference".
AdBSTR    Pointer of BSTR  . For more information about this type, please refer to "OLE   DB    Programmer Reference".
AdChar   Fixed length string.
AdVarChar   Variable length string.
AdLongVarChar   Long-change long string.
AdWChar   Wide fixed length string.
AdVarWChar   Wide variable length string.
AdLongVarWChar   Length, width variable length string.
AdBinary   Fixed length binary data.
AdVarBinary   Variable length binary data.
AdLongVarBinary   Long-change-long binary data.


illustrate

The default value is adVarWChar.

Append to the Column object to the collection or