This example demonstrates the Clustered property of an Index. Note that Microsoft Jet databases do not support clustered indexes, so this example will return False for the Clustered property of all indexes in the Northwind database.
' BeginClusteredVB Sub ClusteredX() Dim cnn As New ADODB.Connection Dim cat As New ADOX.Catalog Dim tblLoop As ADOX.Table Dim idxLoop As ADOX.Index Dim strCnn As String strCnn = "Provider=SQLOLEDB;Data Source=srv;Initial Catalog=pubs;" & _ "User Id=sa;Password=;" ' Connect the catalog. cnn.Open strCnn cat.ActiveConnection = cnn ' Enumerate Tables For Each tblLoop In cat.Tables 'Enumerate Indexes For Each idxLoop In tblLoop.Indexes Debug.Print tblLoop.Name & " " & _ idxLoop.Name & " " & idxLoop.Clustered Next idxLoop Next tblLoop End Sub ' EndClusteredVB
Catalog Object | Clustered Property | Index Object | Table Object
© 1998-2001 Microsoft Corporation. All rights reserved.