好象没有哪个属性 针对SQL-SERVER 用ADODB的Recordset对象执行select 'Identity'= isnull(name,'No identity column defined.'), 'Seed'= ident_seed(N'youtablename'), 'Increment'= ident_incr(N'youtablename'), 'Not For Replication'= ColumnProperty(object_id(N'youtablename'), name, 'IsIDNotForRepl') from syscolumns where id=object_id(N'youtablename') and colstat & 1 = 1得到是否是自动加1的字段sp_pkeys youtablename得到表的主键 然后自己再判断
Dim adoConnection As New ADODB.Connection Dim CatalogX As New ADOX.Catalog adoConnection.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\data\NWind97.mdb;Persist Security Info=False" 'adoConnection.Open "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Password=sa;Initial Catalog=northwind;Data Source=" Set CatalogX.ActiveConnection = adoConnection 'Autoincrement 为一个动态属性 Debug.Print CatalogX.Tables.Item("YourTableName").Columns.Item("YourFieldName").Properties.Item("Autoincrement").Value
针对SQL-SERVER
用ADODB的Recordset对象执行select 'Identity'= isnull(name,'No identity column defined.'),
'Seed'= ident_seed(N'youtablename'),
'Increment'= ident_incr(N'youtablename'),
'Not For Replication'= ColumnProperty(object_id(N'youtablename'), name, 'IsIDNotForRepl')
from syscolumns where id=object_id(N'youtablename') and colstat & 1 = 1得到是否是自动加1的字段sp_pkeys youtablename得到表的主键
然后自己再判断
Dim CatalogX As New ADOX.Catalog
adoConnection.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\data\NWind97.mdb;Persist Security Info=False"
'adoConnection.Open "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Password=sa;Initial Catalog=northwind;Data Source="
Set CatalogX.ActiveConnection = adoConnection
'Autoincrement 为一个动态属性
Debug.Print CatalogX.Tables.Item("YourTableName").Columns.Item("YourFieldName").Properties.Item("Autoincrement").Value