數據庫表及字段的查詢
//得到數據庫中所有表的名字;
string sql = " select name from sysobjects where type='U'";
//通過表名獲取所有字段名;
string sql = "Select name from syscolumns Where ID=OBJECT_ID('"+tableName+"')";
//通過表名獲取所有字段名和類型;
select column_name,data_type from information_schema.columns where table_name = '表名'
最後更新:2017-04-02 04:00:23