我如何从一个ODBC连接可用表的列表? [英] How do I get a list of available tables from an ODBC connection?
问题描述
在Excel中我可以去数据 - >导入外部数据 - >导入数据...,然后选择要使用的数据源,然后在我提供的登录信息它给我的表的列表。我想知道如何编程获取该列表使用C#。
In Excel I can go to Data -> Import External Data -> Import Data... and then select the data source to use and then after I provide login information it gives me a list of tables. I would like to know how to get that list programmatically using C#.
推荐答案
什么类型的数据源,你询问? SQL Server的? ?访问
What type of data source are you interrogating? SQL Server? Access?
对于OdbcConnection.GetSchema方法这里。此外文档:
的 http://msdn.microsoft.com/en-us/library/system.data.odbc.odbcconnection.getschema.aspx
Also documentation for the OdbcConnection.GetSchema Method here: http://msdn.microsoft.com/en-us/library/system.data.odbc.odbcconnection.getschema.aspx
这可能会为你工作:OdbcConnection.GetSchema(表格)
This may work for you: OdbcConnection.GetSchema("Tables")
-Krip
这篇关于我如何从一个ODBC连接可用表的列表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!