从数据库获取所有表的列表 [英] Get list of all tables from database
本文介绍了从数据库获取所有表的列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何从数据库的列表框控件中获取所有具有其名称的表的列表?
How to get list of all tables with their names in a listbox control from Database ?
推荐答案
这很简单,但这取决于什么您使用的数据库系统.
尝试使用SQL:
It''s quite simple, but it will depend on what DB system you use.
Try the SQL:
SELECT * FROM INFORMATION_SCHEMA.TABLES
现在,另一种选择是使用ado.net连接到数据库并调用
And now the aternative option is using your ado.net connection to your database and calling
connection.GetSchema("Tables")
然后您可以填充一个DataTable并将数据绑定到您的UI中
有关示例,请参见此处的msdn
and you can populate a DataTable and data bind to that in your UI
for examples see msdn here
这篇关于从数据库获取所有表的列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文