国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > .NET > 正文

使用.Net獲取OLEDB數據庫的架構.

2024-07-10 13:03:09
字體:
來源:轉載
供稿:網友
獲得sql server數據庫的信息可以使用dmo組件或直接獲取系統表的信息,例如表,視圖,存儲過程等存在sysobjects表中,列的信息存在syscolumns表中。如果要獲取oledb數據庫的信息,例如access的數據庫。

首先引用com組件microsoft activex data object 2.x library和microsoft ado ext. 2.x for ddl...
下面是c#代碼:

string strconnection = “provider=microsoft.jet.oledb.4.0;data source=“c://test.mdb“;

adodb.connection conn = new adodb.connectionclass();
conn.connectionstring = strconnection;

conn.open( strconnection , "admin","" , 0 );


adox.catalog ctg = new adox.catalogclass();
ctg.let_activeconnection( conn );

// get tables info from oledb database
for( int i = 0 ; i < ctg.tables.count-1; i++)
{
console.writeline( ctg.tables[ i ].name );
}

// get columns information from a table named test.
adox.table table = ctg.tables[ "test" ];
for( int i = 0 ; i < table.columns.count - 1; i++)
{
adox.column column = table.columns[ i ];
console.writeline( column.name + “/t“ + columns.type.tostring() + column.defaultsize.tostring() );
}
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 琼中| 永泰县| 琼中| 富蕴县| 阿图什市| 秦皇岛市| 土默特右旗| 正蓝旗| 佛教| 凤山市| 永登县| 晋江市| 津市市| 扎赉特旗| 任丘市| 都匀市| 五华县| 文安县| 郑州市| 翼城县| 班玛县| 连城县| 南乐县| 于田县| 黑山县| 宣城市| 东海县| 襄城县| 灌南县| 溧水县| 图们市| 义乌市| 巧家县| 德阳市| 兴山县| 永昌县| 荔波县| 旅游| 容城县| 桐乡市| 兴隆县|