How to list tables of sql database
hi,I am having a problem with getting list of all tables from available database.
I have created sql datase and dont know how to get list of all tables from that database. i have tried following code.dont know whether it is right or wrong.
SqlConnection c = new SqlConnection(@"Data Source=.\SQLEXPRESS;AttachDbFilename=C:\Users\user\Documents\Visual Studio 2008\Projects\WebApplication3\WebApplication3\App_Data\Databas1.mdf;Integrated Security=True;User Instance=True");
DataTable dt = new DataTable();
c.Open();
dt = c.GetSchema();
c.Close();
GridView d = new GridView();
d.DataSource = dt;
d.DataBind();
form1.Controls.Add(d);