|
Sub testKey()
On Error GoTo err_this
Dim adoxcat As New ADOX.Catalog
Dim adoxtbl As New ADOX.Table
Dim adoxkey As New ADOX.Key
Dim intKeys As Integer
Dim intKey As Integer
strTblName = "L_CustVirtualStoreDetail"
adoxcat.ActiveConnection = CurrentProject.Connection
Set adoxtbl = adoxcat.Tables(strTblName)
Debug.Print adoxcat.Tables(strTblName).name
' Set adoxkey = adoxtbl.Keys
' For Each adoxkey In adoxtbl.Keys
intKeys = adoxtbl.Keys.Count - 1
For intKey = 0 To intKeys
Debug.Print adoxtbl.Keys.Item(intKey).name
Next intKey
' Debug.Print adoxkey.Columns
Debug.Print adoxkey.name, adoxkey.Type
' Next
Set adoxkey = Nothing
Set adoxtbl = Nothing
Set adoxcat = Nothing
exit_sub:
Exit Sub
err_this:
MsgBox Err.Description, vbOKOnly + vbCritical, Err.Number
Resume exit_sub
End Sub
但是我现在得到的并不是Key所在列的名字?问怎么得到?谢! |
|