`
jinvasshole
  • 浏览: 775302 次
文章分类
社区版块
存档分类
最新评论

应用ADO.net得到系统表信息

 
阅读更多
'---------------------------------------------------------- '开发者:赵玉 '开发时间:2005.1.13 '功能:应用ADO.net得到表 '---------------------------------------------------------- Imports Zy_DataAccess Imports System Imports System.Data Imports System.Data.SqlClient Imports System.Data.OleDb Public Class ClsGetTables '---------------------------------------------------------- '开发时间:2004.9.9 '功能:得到所有表 '---------------------------------------------------------- Public Function GetAllTables(ByVal CnStr As String) As DataTable Dim conn As New OleDbConnection(CnStr) conn.Open() Dim schemaTable As DataTable = conn.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, _ New Object() {Nothing, Nothing, Nothing, Nothing}) ' "TABLE"}) conn.Close() Return schemaTable End Function '---------------------------------------------------------- '开发时间:2004.9.9 '功能:得系统表 '---------------------------------------------------------- Public Function GetSystemTables(ByVal CnStr As String) As DataTable Dim conn As New OleDbConnection(CnStr) conn.Open() Dim schemaTable As DataTable = conn.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, _ New Object() {Nothing, Nothing, Nothing, "SYSTEM TABLE"}) conn.Close() Return schemaTable End Function '---------------------------------------------------------- '开发时间:2004.9.9 '功能:得用户表 '---------------------------------------------------------- Public Function GetUserTables(ByVal CnStr As String) As DataTable Dim conn As New OleDbConnection(CnStr) conn.Open() Dim schemaTable As DataTable = conn.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, _ New Object() {Nothing, Nothing, Nothing, "TABLE"}) conn.Close() Return schemaTable End Function '---------------------------------------------------------- '开发时间:2004.9.9 '功能:得到系统视图 '---------------------------------------------------------- Public Function GetSystemViews(ByVal CnStr As String) As DataTable Dim conn As New OleDbConnection(CnStr) conn.Open() Dim schemaTable As DataTable = conn.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, _ New Object() {Nothing, Nothing, Nothing, "SYSTEM VIEW"}) ' "TABLE"}) conn.Close() Return schemaTable End Function '---------------------------------------------------------- '开发时间:2004.9.9 '功能:得到用户视图 '---------------------------------------------------------- Public Function GetUserViews(ByVal CnStr As String) As DataTable Dim conn As New OleDbConnection(CnStr) conn.Open() Dim schemaTable As DataTable = conn.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, _ New Object() {Nothing, Nothing, Nothing, "VIEW"}) ' "TABLE"}) conn.Close() Return schemaTable End Function '---------------------------------------------------------- '开发时间:2004.9.9 '功能:得到所有过程 '---------------------------------------------------------- Public Function GetStoredProcedures(ByVal CnStr As String) As DataTable Dim conn As New OleDbConnection(CnStr) conn.Open() Dim schemaTable As DataTable = conn.GetOleDbSchemaTable(OleDbSchemaGuid.Procedures, New Object() {Nothing, Nothing, Nothing, Nothing}) conn.Close() Return schemaTable End Function '---------------------------------------------------------- '开发时间:2004.9.9 '功能:得到数据类型 '---------------------------------------------------------- Public Function GetDataTypes(ByVal CnStr As String) As DataTable Dim conn As New OleDbConnection(CnStr) conn.Open() Dim schemaTable As DataTable = conn.GetOleDbSchemaTable(OleDbSchemaGuid.Provider_Types, New Object() {Nothing}) conn.Close() Return schemaTable End Function '---------------------------------------------------------- '开发时间:2004.9.9 '功能:得到表的列,My_Tablename为空是所有的 '---------------------------------------------------------- Public Function GetTableColumns(ByVal CnStr As String, ByVal My_Tablename As String) As DataTable Dim conn As New OleDbConnection(CnStr) conn.Open() If My_Tablename.Trim = "" Then My_Tablename = Nothing End If Dim schemaTable As DataTable = conn.GetOleDbSchemaTable(OleDbSchemaGuid.Columns, New Object() {Nothing, Nothing, My_Tablename, Nothing}) conn.Close() Return schemaTable End Function '---------------------------------------------------------- '开发时间:2004.9.9 '功能:数据库名 '---------------------------------------------------------- Public Function GetDbname(ByVal CnStr As String) As DataTable Dim conn As New OleDbConnection(CnStr) conn.Open() Dim schemaTable As DataTable = conn.GetOleDbSchemaTable(OleDbSchemaGuid.Catalogs, New Object() {Nothing}) conn.Close() Return schemaTable End Function '---------------------------------------------------------- '开发时间:2004.9.9 '功能:数据库表列的权限 '---------------------------------------------------------- Public Function GetColumn_Privileges(ByVal CnStr As String) As DataTable Dim conn As New OleDbConnection(CnStr) conn.Open() Dim schemaTable As DataTable = conn.GetOleDbSchemaTable(OleDbSchemaGuid.Column_Privileges, New Object() {Nothing}) conn.Close() Return schemaTable End Function '---------------------------------------------------------- '开发时间:2004.9.9 '功能:数据库表的索引 '---------------------------------------------------------- Public Function GetIndexes(ByVal CnStr As String) As DataTable Dim conn As New OleDbConnection(CnStr) conn.Open() Dim schemaTable As DataTable = conn.GetOleDbSchemaTable(OleDbSchemaGuid.Indexes, New Object() {Nothing}) conn.Close() Return schemaTable End Function '---------------------------------------------------------- '开发时间:2004.9.9 '功能:数据库表的主键 '---------------------------------------------------------- Public Function GetPrimary_Keys(ByVal CnStr As String) As DataTable Dim conn As New OleDbConnection(CnStr) conn.Open() Dim schemaTable As DataTable = conn.GetOleDbSchemaTable(OleDbSchemaGuid.Primary_Keys, New Object() {Nothing}) conn.Close() Return schemaTable End Function '---------------------------------------------------------- '开发时间:2004.9.9 '功能:数据库的存储过程的参数 '---------------------------------------------------------- Public Function GetProcedure_Parameters(ByVal CnStr As String) As DataTable Dim conn As New OleDbConnection(CnStr) conn.Open() Dim schemaTable As DataTable = conn.GetOleDbSchemaTable(OleDbSchemaGuid.Procedure_Parameters, New Object() {Nothing}) conn.Close() Return schemaTable End Function '---------------------------------------------------------- '开发时间:2004.9.9 '功能:数据库的架构信息 '---------------------------------------------------------- Public Function GetSchemata(ByVal CnStr As String) As DataTable Dim conn As New OleDbConnection(CnStr) conn.Open() Dim schemaTable As DataTable = conn.GetOleDbSchemaTable(OleDbSchemaGuid.Schemata, New Object() {Nothing}) conn.Close() Return schemaTable End Function '---------------------------------------------------------- '开发时间:2004.9.9 '功能:数据库的表的记录数统计 '---------------------------------------------------------- Public Function GetStatistics(ByVal CnStr As String) As DataTable Dim conn As New OleDbConnection(CnStr) conn.Open() Dim schemaTable As DataTable = conn.GetOleDbSchemaTable(OleDbSchemaGuid.Statistics, New Object() {Nothing}) conn.Close() Return schemaTable End Function '---------------------------------------------------------- '开发时间:2004.9.9 '功能:数据库的表的记录数统计 '---------------------------------------------------------- Public Function GetTable_Statistics(ByVal CnStr As String) As DataTable Dim conn As New OleDbConnection(CnStr) conn.Open() Dim schemaTable As DataTable = conn.GetOleDbSchemaTable(OleDbSchemaGuid.Table_Statistics, New Object() {Nothing}) conn.Close() Return schemaTable End Function '---------------------------------------------------------- '开发时间:2004.9.9 '功能:数据库的中用户可访问的表 '---------------------------------------------------------- Public Function GetTables_Info(ByVal CnStr As String) As DataTable Dim conn As New OleDbConnection(CnStr) conn.Open() Dim schemaTable As DataTable = conn.GetOleDbSchemaTable(OleDbSchemaGuid.Tables_Info, New Object() {Nothing}) conn.Close() Return schemaTable End Function End Class
分享到:
评论

相关推荐

    ado[1].net中文手册 学习 ado.net的重要资料

    ADO.NET 示例应用程序:提供 ADO.NET 应用程序的示例,该示例从数据库中检索数据并将其返回到控制台。   使用 .NET 数据提供程序访问数据 使用 ADO.NET 连接到数据源:描述 ADO.NET Connection 对象,并说明如何...

    程序员大本营.NET版精华文章

    同时ADO.NET又保持着与以前的ADO模型有关的一些主要概念,它已经被极大的完善,并从不同的信息来源提供途径去获得结构化的数据----一个平台文本文件,从数据库管理系统获得的相关数据,或者是分级的XML数据----然而...

    Asp.Net技术文档

    <br/>同时ADO.NET又保持着与以前的ADO模型有关的一些主要概念,它已经被极大的完善,并从不同的信息来源提供途径去获得结构化的数据----一个平台文本文件,从数据库管理系统获得的相关数据,或者是分级的XML...

    ASP.NET在线测评系统

    中间层包括一些重要的系统服务,如ADO.Net,XML类,组件模型,安全性等,这些服务在总架构的控制之下,可以在各处通用,而且调用方式与语言无关。顶层主要提供给程序开发者开发Window窗体和WEB表单,WEB服务、应用...

    ADO.NET编程之基础知识

    ADO.NET是专门为帮助开发人员建立在Intranet或Internet上使用的高效多层数据库应用程序而设计的,它作为Windows平台下开发应用系统的数据访问技术,已经在企业信息系统的开发中得到了广泛的应用。

    毕业设计:ASP.NET+SQL房地产管理系统设计与实现(开题报告+源代码+论文+任务书+工作总结+答辩PPT)

    Microsoft .NET作为一种面向网络、支持各种用户终端的开发平台环境,推动新一代因特网的发展,真正地让人们可以在任何时间、任何地点、通过任何设备得到信息。 ASP .NET是建立在.NET平台架构上,使用通用语言运行时...

    认证培训之一:微软.NET程序员高级培训教程系列资料

    * 演示:展示了.NET Framework 与 VS.NET的操作系统、Common Language Runtime、ADO.NET、ASP.NET、Windows Forms等方面的内容。 Session 3:企业级应用程序的构架 * 案例学习:PetShop .NET,学习如何使用.NET ...

    asp.net知识库

    通过查询系统表得到纵向的表结构 将数据库表中的数据生成Insert脚本的存储过程!!! 2分法-通用存储过程分页(top max模式)版本(性能相对之前的not in版本极大提高) 分页存储过程:排序反转分页法 优化后的通用分页存储...

    ASP.NET+SQL房地产管理系统设计与实现(开题报告+源代码+论文+任务书+工作总结+答辩PPT)

    ASP.NET+SQL房地产管理系统设计与实现(开题报告+源代码+论文+任务书+工作总结+答辩PPT)Microsoft .NET作为一种面向网络、支持各种用户终端的开发平台环境,推动新一代因特网的发展,真正地让人们可以在任何时间、...

    车辆调度系统---论文

    计算机是一门研究用计算机进行信息表示和处理的科学,这就...本文描述的是一个基于ASP.NET开发车辆调度系统的设计与实现,开发语言采用C#,开发工具采用VS 2008,数据库使用Sql Server 2005,连接数据库采用ADO.NET。

    基于UML和.NET技术的高校科技信息管理系统实现

    主要介绍了应用面向对象的UML建模技术设计的高校科技信息管理系统,ASP.NET下的MVC设计模式实现,以及ASP.NET关键技术在系统的应用,包括应用代码分离技术实现界面设计和程序设计分离,ADO.NET访问数据库的技术以及数据...

    El Inputte for .NET---最新标准的输入界面控件

    Windows Form、100%GrapeCity自主开发、全面支持ADO.NET 继承了El Inputte (日本产品名为InputMan)多个版本的卓越性能的基础上,基于.NET Framework开发的新版本El Inputte for NET中文版即将隆重上市。 El ...

    ASP.NET4高级程序设计第4版 带目录PDF 分卷压缩包 part1

    7.1.1 ADO.NET数据提供程序 7.1.2 ADO.NET的标准化 7.1.3 基本ADO.NET类 7.2 Connection类 7.2.1 连接字符串 7.2.2 测试连接 7.2.3 连接池 7.3 Command类和DataReader类 7.3.1 Command基础 7.3.2...

    蓝焰设计站图文管理系统

    【摘要】利用ASP.NET和ADO.NET技术开发的网站新闻管理系统,实现了网站新闻的动态管理,使得对信息的管理更加及时、高效,提高了工作效率。同时对系统的开发原理、系统的功能特点和设计方案进行了介绍。 【关键词】...

    ASP.NET4高级程序设计(第4版) 3/3

    7.1.1 ADO.NET数据提供程序 209 7.1.2 ADO.NET的标准化 210 7.1.3 基本ADO.NET类 211 7.2 Connection类 212 7.2.1 连接字符串 212 7.2.2 测试连接 214 7.2.3 连接池 215 7.3 Command类和DataReader类...

    asp.net专家疑难解答200问

    如何解决ADO.NET访问ACCESS数据库出现“操作必须使用一个可更新的查询”的问题 168.如何从EXCEL文件中读取数据 169.如何备份和恢复数据库 第9章 ASP.NET安全策略 第10章 常用功能及函数集 180....

Global site tag (gtag.js) - Google Analytics