查询数据库中的所有表_个人博客查询数据库中的所有表_其他_02Code

    private static DataTable GetSqlDatabaseSchema(string strConn)

    {

        SqlConnection connection = new SqlConnection(strConn);

        DataTable schema = new DataTable();

        try

        {

            connection.Open();

            schema = connection.GetSchema("TABLES");

        }

        catch

        {

            schema = null;

        }

        finally

        {

            connection.Close();

        }

        return schema;

    }


TABLE_CATALOG

TABLE_SCHEMA

TABLE_NAME

TABLE_TYPE

DB

dbo

StatSystem

BASE TABLE

DB

dbo

Version

BASE TABLE

DB

dbo

Advertisement

BASE TABLE

DB

dbo

UserList

BASE TABLE


作者:KKcat