,歡迎訪問網頁設計愛好者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