是否primary key: 用adox.key对象,有一个type属性返回KeyTypeEnum常量(adKeyPrimary, adKeyForeign, adKeyUnique).是否自动加一:用column对象,有properties集合,包含所有的列属性。

解决方案 »

  1.   

    是否primary key: 用adox.key对象,有一个type属性返回KeyTypeEnum常量(adKeyPrimary, adKeyForeign, adKeyUnique).是否自动加一:用column对象,有properties集合,包含所有的列属性。
      

  2.   

    好象没有哪个属性
    针对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得到表的主键
    然后自己再判断
      

  3.   

    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