![ContractedBlock.gif](https://www.cnblogs.com/Images/OutliningIndicators/ContractedBlock.gif)
![ExpandedBlockStart.gif](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedBlockStart.gif)
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 |