
How to Compare Tables, Fields, & Field Properties
You will probably find the info you need in this sample using the
OpenSchema. It does require that you are using a provider that supports the
methods you use (AdSchemaColumns, Tables, Etc) This sample uses the Pubs
database in SQL server. To use with an Access DB you would need to change
the connection string to the Access string provided.( Be sure to change the
Path to a valid mdb file)
Place 3 Datagrids on a form. DataGrid1, DataGrid2, and DataGrid3
Set a project reference to Microsoft ActiveX DataObjects 2.x library.
Paste this code into a form.
----------------------------------------------------------------------------
---------
Dim adoPrimaryRS As Recordset
Private Sub Form_Load()
Dim db As Connection
Dim RS1 As Recordset
Dim RS2 As Recordset
Dim RS3 As Recordset
Set db = New Connection
db.CursorLocation = adUseClient
'For SQL Server use following connection
db.Open "PROVIDER=sqloledb;driver={SQL
Server};server=Darkover;uid=sa;pwd=;database=Pubs;"
'For Access Database use following connection
'db.Open "PROVIDER=Microsoft.Jet.Oledb.4.0;data Source=e:\Northwind.mdb;"
Set RS1 = db.OpenSchema(adSchemaColumns)
Set DataGrid1.DataSource = RS1
Set RS2 = db.OpenSchema(adSchemaIndexes)
Set DataGrid2.DataSource = RS2
Set RS3 = db.OpenSchema(adSchemaTables)
Set DataGrid3.DataSource = RS3
End Sub
----------------------------------------------------------------------------
--------