检索数据库表架构 [英] Retreiving database table schemas

查看:78
本文介绍了检索数据库表架构的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近一直在创建一个应用程序,我需要一些有关数据库表模式的帮助.我已使用mysql数据库在vb.net 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.net 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.


这篇关于检索数据库表架构的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆