Listing all the Tables of Current database

Introduction

This blog lists all the table available in the current database taking the help of system table. to list the tables of database i have taken the help of ado.net, using ado.net you cant list the current database table. see the bellow code for more details

     SqlConnection connection=new SqlConnection("ConnectionString");
            connection.Open();
            SqlCommand command = new SqlCommand("select name as TableName,create_date from sys.tables",connection);
            SqlDataAdapter adapter = new SqlDataAdapter(command);
            DataTable dataTable=new DataTable();
            adapter.Fill(dataTable);


Ebook Download
View all
Learn
View all