string connectionString = "...";
DataTable tables = new DataTable("Tables");
using (SqlConnection connection =
new SqlConnection(connectionString))
{
SqlCommand command = connection.CreateCommand();
command.CommandText = "select table_name as Name from
INFORMATION_SCHEMA.Tables where TABLE_TYPE =
'BASE TABLE'";
connection.Open();
tables.Load(command.ExecuteReader(
CommandBehavior.CloseConnection));
}
Thursday, October 23, 2008
Get List of Tables in a Database - Query INFORMATION_SCHEMA.Tables - ADO.NET
Subscribe to:
Post Comments (Atom)
1 comment:
really useful information..thanks for posting Manpreet..
Post a Comment