如何获取表架构 [英] How to get table Schema
问题描述
我正在使用Microsoft Visual Studio2005.有人可以告诉我如何获取MS Access数据库的表名和列名吗?
I am working with Microsoft visual studio 2005.Can anyone tell me how to get table names and column names of a MS access database?
推荐答案
通常,您应该使用数据库驱动程序的元数据工具来执行此操作.我听说过所有数据库调用级别的API,这些API可以返回数据库元数据(通常作为结果集)的提供方法/功能/过程.
Typically, you should the metadata facilities of your database driver to do that. All database call level APIs I have heard of supply methods/functions/procedures that can return database metadata, typically as a resultset.
您没有提到任何语言,因此假设您使用的是C#.在这种情况下,您将创建一个OleDB(OleDB是.NET语言的驱动程序框架)连接对象,并在其上调用GetOleDbSchemaTable
方法.然后,这将为您提供一个DataTable
对象,该对象使您可以访问传达此信息的数据行.
You didn't mention any language, so lets assume you're using C#. In that case, you'd make a OleDB (OleDB is driver framework for .NET languages) connection object, and invoke the GetOleDbSchemaTable
method on it. This will then give you a DataTable
object that gives you access to the rows of data that convey this information.
有关OleDB的示例,请参见: http://msdn.microsoft.com/zh-CN/library/aa288452(VS.71).aspx
For an OleDB example, see: http://msdn.microsoft.com/en-us/library/aa288452(VS.71).aspx
对于GetOleDbSchemaTable方法,请参见: http://msdn.microsoft.com/zh-cn/library/system.data.oledb.oledbconnection.getoledbschematable(VS.71).aspx
For the GetOleDbSchemaTable method, see: http://msdn.microsoft.com/en-us/library/system.data.oledb.oledbconnection.getoledbschematable(VS.71).aspx
For information on the types of metadata provided by OleDB, see: http://msdn.microsoft.com/en-us/library/system.data.oledb.oledbschemaguid_members(VS.71).aspx
这篇关于如何获取表架构的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!