How do I get a list of available tables from an ODBC connection?

≯℡__Kan透↙ 提交于 2019-12-04 05:34:05
Krip

What type of data source are you interrogating? SQL Server? Access?

Look at this thread: http://social.msdn.microsoft.com/Forums/en-US/csharpgeneral/thread/bcf25d16-3ecd-427d-9ad2-57619d6b3691

Also documentation for the OdbcConnection.GetSchema Method here: http://msdn.microsoft.com/en-us/library/system.data.odbc.odbcconnection.getschema.aspx

This may work for you: OdbcConnection.GetSchema("Tables")

Normally, you would have to be a bit more explicit to disregard system tables:

connection.GetSchema("Tables").AsEnumerable().Where(r => r.Field<string>("TABLE_TYPE") == "TABLE")
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!