用adox 取 access 自增列

百度很久 最后在 (.NET2.0下用ADOX动态创建ACCESS数据库(C#))

http://blog.csdn.net/black4371/article/details/4423739 找到了

public string getAutoIncrement(string tablename, string con)
        {
            ADOX.Catalog catalog = new Catalog();
            catalog.let_ActiveConnection(con);
            ADOX.Table tbl = new ADOX.Table();
            Tables tbs = catalog.Tables;
            foreach (Table tb in tbs)
            {
                string str = tb.Name;
                if (tablename == tb.Name)
                {
                    foreach (Column col in tb.Columns)
                    {
                        if (col.Properties["AutoIncrement"].Value == true)
                            return col.Name.ToString();
                    }
                }
            }
            return "";
        }
    }

 

 

 

ADOX column properties   http://blog.163.com/akins@126/blog/static/47553796200981132124412/
-----------------------------------
Autoincrement
Description
"Nullable"
"Fixed Length"
"Seed"
"Increment"
"Jet OLEDB:Column Validation Text"
"Jet OLEDB:Column Validation Rule"
"Jet OLEDB:IISAM Not Last Column"
"Jet OLEDB:AutoGenerate"
"Jet OLEDB:One BLOB per Page"
"Jet OLEDB:Compressed UNICODE Strings"
"Jet OLEDB:Allow Zero Length"
"Jet OLEDB:Hyperlink"

 

 

-------------------------------------------------

ado如何取得表的所有字段信息?《VBA》

http://access911.net/fixhtm/74FAB11E10DC.htm?tt=

posted @ 2013-10-14 08:44  ccqin  阅读(732)  评论(0编辑  收藏  举报