Hi,
I need to list out tables in a entire Sql server(local network). How can i do it c#.net.
Regards,
k.kishore
List Tables in a Sql server
1 Answer
Know the answer? Post it. Somebody with the same question will find it here.
Know the answer? Post it. Somebody with the same question will find it here.
Mike GoldRank #50 · 30.6K pointsPosted Mar 7, 2007, 1:51 PM EST
http://www.c-sharpcorner.com/UploadFile/mgold/Query2Excel12032005011029AM/Query2Excel.aspx
Basically you'll need to connect with a SqlAdapter, fill a dataset with tables you are interested in and loop through each data row in the tables in the dataset. You'll need to do multiple fills if you want to fill the same dataset. This will require you changing the CommandText of the adapter on the fly to handle a query for each table (see http://www.developer.com/db/article.php/3311341
-Mike