Share via


Converting OLE DB Data Types to Visual Basic Scripting Edition Variant Types

[Indexing Service is no longer supported as of Windows XP and is unavailable for use as of Windows 8. Instead, use Windows Search for client side search and Microsoft Search Server Express for server side search.]

Because all programming access to Indexing Service is through the OLE DB Provider, you can retrieve only supported OLE DB data types when you ask for information back from a query. VBScript supports certain Automation data types within its VARIANT data-type implementation. The following table lists the OLE DB data types supported, their equivalent Automation variant types, and any formatting restrictions imposed when displaying the data to an end user through VBScript.

OLE DB data type Automation Variant type Formatting restrictions
DBTYPE_I1 VT_I1 Integer. Expressed either in decimal (base 10) or hexadecimal (base 16) notation. The latter requires 0x before the number, for example, 0xf8.
DBTYPE_UI1 VT_UI1 Integer. Expressed either in decimal (base 10) or hexadecimal (base 16) notation. The latter requires 0x before the number.
DBTYPE_I2 VT_I2 Integer. Expressed either in decimal (base 10) or hexadecimal (base 16) notation. The latter requires 0x before the number.
DBTYPE_UI2 VT_UI2 Integer. Expressed either in decimal (base 10) or hexadecimal (base 16) notation. The latter requires 0x before the number.
DBTYPE_I4 VT_I4 Integer. Expressed either in decimal (base 10) or hexadecimal (base 16) notation. The latter requires 0x before the number.
DBTYPE_UI4 VT_UI4 Integer. Expressed either in decimal (base 10) or hexadecimal (base 16) notation. The latter requires 0x before the number.
DBTYPE_I8 VT_I8 Integer. Expressed either in decimal (base 10) or hexadecimal (base 16) notation. The latter requires 0x before the number.
DBTYPE_UI8 VT_UI8 Integer. Expressed either in decimal (base 10) or hexadecimal (base 16) notation. The latter requires 0x before the number.
DBTYPE_R4 VT_R4 Real number. Can be expressed in scientific notation.
DBTYPE_R8 VT_R8 Real number. Can be expressed in scientific notation.
DBTYPE_CY VT_CY Currency. Expressed as two integers, separated by a period; for example, 100.55. Cannot be preceded by $, ¥, £, or other such signs. This data type does not specify the currency format.
DBTYPE_DATE VT_DATE Date. Expressed as an absolute in two forms: yyyy/mm/dd and yyyy/mm/dd hh:mm:ss. Also expressed as a relative date: -#y, -#m, -#w, -#d, -#h, -#n, -#s where the letters correspond to year, month, week, day, hour, minute and second. Positive relative dates in the future are not supported.
DBTYPE_BOOL VT_BOOL Boolean. Expressed as TRUE or FALSE.
DBTYPE_STR VT_LPSTR String. Any input accepted.
DBTYPE_WSTR VT_LPWSTR Unicode string. Any input accepted.
DBTYPE_BSTR VT_BSTR Basic string. Any input accepted.
DBTYPE_GUID VT_CLSID Globally unique identifier (GUID). Expressed as XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX.
DBTYPE_BYREF (not applicable) For queries, this should be added to DBTYPE_STR and DBTYPE_WSTR string types. For example: DBTYPE_WSTR | DBTYPE_BYREF.
DBTYPE_VECTOR VT_VECTOR Vector properties are fully supported.
VT_FILETIME VT_FILETIME Expressed as an absolute in two forms: yyyy/mm/dd and yyyy/mm/dd hh:mm:ss. Also expressed as a relative date: -#y, -#m, -#w, -#d, -#h, -#n, -#s where the letters correspond to year, month, week, day, hour, minute and second. Positive relative dates into the future are not supported.