Apply ADO.NET to get system table information

xiaoxiao2021-03-06  39

Table "}) conn.close () Return Schematable End Function '-------------------------------------------------------------------------------------------------------------------------------------------- ---------------------- 'Development Time: 2004.9.9' Features: Get the System View '-------------- -------------------------------------------- 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 () returnch scheMATABLE END FUNCTION '----------------------------------- ----------------------- 'Development Time: 2004.9.9' Features: Get User View '------------- -------------------------------------------- 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 '-------------------------------------------------------------------------------------------------------------------------------- ------------------------ 'Development Time: 2004.9.9' Features: Get all processes' ------------ ---------------------------------------------- Public Function GetstoredProcedProcedProcedProcedund 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 '------------------------------------------- --------------- 'Development Time: 2004.9.9' Features: Get Data Type '

-------------------------------------------------- -------- 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 () { Noth.Close () Return Schematable end function '------------------------------------- --------------------- 'Development Time: 2004.9.9' Features: Get the column of the table, MY_TABLENAME is empty is all '------- -------------------------------------------------- - 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, NOTING}) Conn.close () Return Schematable end function '------------------------------------------------------------------------------------------------------------------------------------ -------------------------------------- 'Development Time: 2004.9.9' Features: Database Name '--------------------------- ------------------------------- 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 '-------------- ------------------------------------------ 'Development time: 2004.9. 9 'Features: Permissions of Database Table Columns' ---------------------------------------------------------------------------------------------------------------------------------------------- -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

CONN.GETOLEDBSCHEMATABLE (OLEDBSChemAGUID.COLUMN_PRIVILEGES, New Object () {Nothing}) Conn.close () Return Schematable End Function '------------------------------------------------------------------------------------------------------------------------------------------ ---------------------------------- 'Development Time: 2004.9.9' Features: Database Table Index '- -------------------------------------------------- ------- 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 '------------------------------------ -------------------- 'Development Time: 2004.9.9' Features: Database Table of Primary Key '--------------- ------------------------------------------- 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 '- ------------------------------------ -------------------- 'Development Time: 2004.9.9' Features: Parameters of the stored procedures of the database ------------- ------------------------------------------- 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 ' -------------------------------------------------- -------- 'Development Time: 2004.9.9' Features: Architecture Information of Database

转载请注明原文地址:https://www.9cbs.com/read-69477.html

New Post(0)