获取数据库架构信息,GetSchema(),参数表

CollectionName
MetaDataCollections
DataSourceInformation
DataTypes
Restrictions
ReservedWords
Users
Databases
Tables
Columns
StructuredTypeMembers
Views
ViewColumns
ProcedureParameters
Procedures
ForeignKeys
IndexColumns
Indexes
UserDefinedTypes
获取数据库架构信息,GetSchema(),参数表
    private DataTable GetSqlDatabaseSchema(string strConn, string collectionName,string[] strs)
    {
        SqlConnection connection 
= new SqlConnection(strConn);
        DataTable schema 
= new DataTable();
        
try
        {
            connection.Open();
            
if (!string.IsNullOrEmpty(collectionName))
            {
                
if (strs != null&&strs.Length >0)
                {
                    schema 
= connection.GetSchema(collectionName, strs);
                }
                
else
                schema 
= connection.GetSchema(collectionName);
            }
            
else
                schema 
= connection.GetSchema();
        }
        
catch
        {
            schema 
= null;
        }
        
finally
        {
            connection.Close();
        }
        
return schema;
    }
本文转自today4king博客园博客,原文链接:http://www.cnblogs.com/jinzhao/archive/2009/07/29/1534023.html,如需转载请自行联系原作者
上一篇:《网站设计 开发 维护 推广 从入门到精通》—— 2.5 经典习题与解答


下一篇:戴尔&EMC收购案正式结束之后要关注的问题