Article ID: 193947 - View products that this article applies to.
This article was previously published under Q193947
In an application, sometimes it is useful to determine the properties of fields in a remote datasource. You can determine information such as the field names, data types and field lengths by examining the Fields collection of the ActiveX Data Objects (ADO) Recordset object.
The following program creates a Recordset from the Authors table of the SQL Server sample Pubs database. It displays the field name, data type, and defined length of each field in the Authors table.
The data type returns as an integer value. The #DEFINE statements at the top of the program are included so that this value can be cross- referenced to a character description of the data type.
In order to use this example, you must have the Microsoft Data Access Components (MDAC) version 2.x or later installed, which is included in the data components of Visual Studio 6.0 or can be downloaded from the following Web address:
http://msdn.microsoft.com/en-us/data/aa937729.aspxNOTE: Substitute values for the SERVER, user id (UID) and password (PWD) values appropriate to your SQL Server installation in the oRecordset.OPEN statement.
Article ID: 193947 - Last Review: July 1, 2004 - Revision: 4.3