我正在使用 MS Access 数据库并尝试从 C# 2.0 获取完整数据。如何使用 ADOX 获取约束名称(例如:Primarykey 的名称而不是主键的字段名称)。
提前感谢马杜
我正在使用 MS Access 数据库并尝试从 C# 2.0 获取完整数据。如何使用 ADOX 获取约束名称(例如:Primarykey 的名称而不是主键的字段名称)。
提前感谢马杜
SQL = "CREATE TABLE PKTEST1 (f1 INT PRIMARY KEY, f2 INT)"
cn.Execute SQL
Set cat.ActiveConnection = cn
'Check all indexes on the table for a primary key'
For Each idx In cat.Tables("PKTEST1").Indexes
If idx.PrimaryKey = True Then
Debug.Print "INDEX NAME: " & idx.Name
'Show all columns that make up the index'
Debug.Print "consists of the following columns:"
For i = 0 To idx.Columns.Count - 1
Debug.Print idx.Columns(i).Name
Next
End If
Next