Assuming you want a C # answer, as it is in your tag, see:
Use SqlConnection.GetSchema to get only tables (no views)
using System.Data.SqlClient;
and
SqlConnection.GetSchema("Tables");
or
SQLCon.Open();
DataTable tables = SQLCon.GetSchema("Tables");
SQLCon.Close();
I would guess that this is actually executing a query for sys or information_schema.tables tables in SQL when opening a connection. sort of:
SELECT * FROM information_schema.tables
or
SELECT * FROM [database].sys.tables
And the equivalent calls other methods inside the class.
For Async calls you can use
Asynchronous Processing=True;
in the connection string
string connectionString = "Data Source=yourDataSource;Initial Catalog=yourCat;Integrated Security=true;Asynchronous Processing=True;";
Is this the answer to your question?
source
share