如何列出自定义组中的表 [英] How to list tables from custom groups
本文介绍了如何列出自定义组中的表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好,
我正在尝试列出自定义组中包含的表(在Access mdb文件中创建)。
如果我使用
Hi all,
I am trying to list the tables included in a custom group(created in an Access mdb file).
If i use
List<string> tables = new List<string>();
DataTable dt = myAccessConn.GetSchema("Tables");
foreach (DataRow row in dt.Rows)
{
string tablename = (string)row[2];
tables.Add(tablename);
}
我将从数据库中获取所有表的列表。有谁知道怎么做?
谢谢你,
Vlad
i will get the list of all the tables from the database. Does anyone know how to do it ?
Thank you,
Vlad
推荐答案
DataTable是架构中的单个实体。所以不要使用它,而是去DataSet
,这是关系/非关系DataTable的集合。请参阅下面的代码,
DataTable is a single entity within your schema. So don't use it, rather go forDataSet
, which is the collection of relational/non-relational DataTable. See my code below,
List<string> tables = new List<string>();
DataSet ds = new DataSet();
foreach (DataTable t in ds.Tables)
{
tables.Add(t.TableName);
}
-KR
-KR
这篇关于如何列出自定义组中的表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文