>Can any one tell me how to get the meta data of recordset in
>Visual Basic.
>
>Say a Record Set contain Three Columns
>====================================
>Column Data Length Decimals
>Name Type
>====================================
>NAME String 40
>AGE Integer 2 0
>SALARY Money 12 2
>====================================
>
>HOW TO GET THESE DETAILS (COLUMN_NAME,
>DATA_TYPE, LENGTH, DECIMALS) OF THE COLUMNS
>IN A RECORDSET ?
Using ADO, you can use OpenSchema to read columns info.
Dim rstSchema As ADODB.Recordset
Set rstSchema = mdbConnect.OpenSchema(adSchemaColumns, Array(Empty, Empty, "TableName"))
With rstSchema
Do Until .EOF
On Error Resume Next
msgbox !COLUMN_NAME
.MoveNext
Loop
.Close
End With
Set rstSchema = Nothing
Next time, place your question in the VB forum! ;~)
Éric Moreau, MCPD, Visual Developer - Visual Basic MVP
Conseiller Principal / Senior Consultant
Moer inc.
http://www.emoreau.com