'----------------------------------------------------------
'Developer:
'Development time: 2004.9.9
'Function: Use ado.net to obtain the table.
'----------------------------------------------------------
Imports zy_dataaccess
Imports system
Imports system. Data
Imports system. Data. sqlclient
Imports system. Data. oledb
Public class clsgettables
'----------------------------------------------------------
'Development time: 2004.9.9
'Function: obtain all tables
'----------------------------------------------------------
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}) '"table "})
Conn. Close ()
Return schematable
End Function
'----------------------------------------------------------
'Development time: 2004.9.9
'Function: Obtain the system table
'----------------------------------------------------------
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, "system table "})
Conn. Close ()
Return schematable
End Function
'----------------------------------------------------------
'Development time: 2004.9.9
'Function: Obtain the user table
'----------------------------------------------------------
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, "table "})
Conn. Close ()
Return schematable
End Function
'----------------------------------------------------------
'Development time: 2004.9.9
'Function: 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, "System View"}) '"table "})
Conn. Close ()
Return schematable
End Function
'----------------------------------------------------------
'Development time: 2004.9.9
'Function: Get the 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, "View"}) '"table "})
Conn. Close ()
Return schematable
End Function
'----------------------------------------------------------
'Development time: 2004.9.9
'Function: Get all processes
'----------------------------------------------------------
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 })
Conn. Close ()
Return schematable
End Function
'----------------------------------------------------------
'Development time: 2004.9.9
'Function: Get the 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 () {nothing })
Conn. Close ()
Return schematable
End Function
'----------------------------------------------------------
'Development time: 2004.9.9
'Function: Obtain the table columns. If my_tablename is null, all columns are obtained.
'----------------------------------------------------------
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
'----------------------------------------------------------
'Development time: 2004.9.9
'Function: 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
'Function: Permission for database Columns
'----------------------------------------------------------
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
'----------------------------------------------------------
'Development time: 2004.9.9
'Function: Index of the database table
'----------------------------------------------------------
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
'Function: Primary Key of the database table
'----------------------------------------------------------
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
'Function: database stored procedure parameters
'----------------------------------------------------------
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
'Function: database architecture Information
'----------------------------------------------------------
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
'----------------------------------------------------------
'Development time: 2004.9.9
'Function: Database Table record count statistics
'----------------------------------------------------------
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
'----------------------------------------------------------
'Development time: 2004.9.9
'Function: Database Table record count statistics
'----------------------------------------------------------
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
'----------------------------------------------------------
'Development time: 2004.9.9
'Function: tables accessible to users in the database
'----------------------------------------------------------
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