首页 > 编程 > .NET > 正文

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

2024-07-10 13:05:06
字体:
来源:转载
供稿:网友
,欢迎访问网页设计爱好者web开发。'---------------------------------------------------------- '开发者:赵玉 '开发时间: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
发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表