【C#源码】查询OLEDB指定表的所有字段

1,129次阅读
没有评论

共计 432 个字符,预计需要花费 2 分钟才能阅读完成。

珍惜源码,传播留址
[v_notice]引用命名空间
using System.Collections.Generic;
using System.Data;
using System.Data.OleDb;
using System.Text;
[/v_notice]
public List<string> GetList(string tn)
{
    DataTable table = dbcon.GetOleDbSchemaTable(OleDbSchemaGuid.Columns, new object[] { null, null, null, null });
    List<string> ts = new List<string>();
    foreach (DataRow row in table.Rows)
    {
        if(row["TABLE_NAME"].ToString()==tn)
            ts.Add(row["COLUMN_NAME"].ToString());
     }
     return ts;
}

测试运行

【C#源码】查询OLEDB指定表的所有字段查询结果:{ID,测试1,测试2,}
正文完
 
lvshujun
版权声明:本站原创文章,由 lvshujun 2019-05-01发表,共计432字。
转载说明:除特殊说明外本站文章皆由CC-4.0协议发布,转载请联系站长并注明出处。
评论(没有评论)
验证码