When I use the sql SELECT * FROM TABLE i get the correct Name, Type and DefinedSize from the recordset.
But I do not want to use sql but query the catalog:
Dim Conn As New ADODB.Connection
'Open connection you want To get database objects
Conn.Provider = "MSDASQL"
Conn.Open "DSN=...;Database=...;", "UID", "PWD"
'Create catalog object
Dim Catalog As New ADOX.Catalog
Set Catalog.ActiveConnection = Conn
'List tables And columns
Dim Table As ADOX.Table, Column As ADOX.Column
For Each Table In Catalog.Tables
For Each Column In Table.Columns
Debug.Print Table.Name & ", " & Column.Name & ", " & Column.Type & ", " & Column.DefinedSize
Next
Next
The problem is that the DefinedSize for query catalog is 0 for numeric types.
Does anyone know of a program to convert Column type to correct size ?
But I do not want to use sql but query the catalog:
Dim Conn As New ADODB.Connection
'Open connection you want To get database objects
Conn.Provider = "MSDASQL"
Conn.Open "DSN=...;Database=...;", "UID", "PWD"
'Create catalog object
Dim Catalog As New ADOX.Catalog
Set Catalog.ActiveConnection = Conn
'List tables And columns
Dim Table As ADOX.Table, Column As ADOX.Column
For Each Table In Catalog.Tables
For Each Column In Table.Columns
Debug.Print Table.Name & ", " & Column.Name & ", " & Column.Type & ", " & Column.DefinedSize
Next
Next
The problem is that the DefinedSize for query catalog is 0 for numeric types.
Does anyone know of a program to convert Column type to correct size ?