我最近一直在创建一个应用程序,我需要一些有关数据库表模式的帮助.我已使用mysql数据库在vb 3.5中对应用程序进行了编程. 应用程序的作用不是很重要……除了我试图获取数据库中表的模式.迄今为止,我在数据库中获取表的模式的方式如下
I have been creating an application recently and I need some help on database table schemas. I have programmed the application in vb 3.5 using a mysql database. What the application does is not really important… except that I am trying to get the schema for a table in the database. To date the way I have been getting the schema for a table in the database is as follows
Dim conn As New MySqlConnection(ConnString) ‘ConnString is defined elsewhere conn.Open() Dim cmd As MySqlCommand = conn.CreateCommand cmd.CommandText = "SELECT * FROM widgets WHERE widgetID=1" ‘Create a datareader and execute it Dim dr As MySqlDataReader dr = cmd.ExecuteReader() ‘Create a datatable to put the schema into Dim dtSchema As New DataTable dtSchema = dr.GetSchemaTable我正在寻找一种无需执行select命令即可获取上表架构的方法.这将有助于我寻求使我的应用程序与多个数据库提供商一起使用.我不希望我的应用程序有任何SQL命令. (我的意图是仅使用数据库中的存储过程) 感谢所有帮助
I am seeking a way of getting the schema for the table above without having to execute the select command. This will help me in my quest to make my app work with more than one DB provider. I don’t want my app to have any SQL commands if at all possible. (my intention is to only use stored procedures in the database) Any help is appreciated
推荐答案此 [ ^ ]文章将帮助您入门. This[^] article will help you get started.
更多推荐
检索数据库表架构
发布评论