This code will help you in getting all databases of Sql Server and show them in the drop down list.
SqlConnection connection = new SqlConnection(connectionstring);
ServerConnection conn = new ServerConnection(connection);
Server myServer = new Server(conn);
foreach (Database db in myServer.Databases)
ddlDatabases.Items.Add(db.Name);
Note: 'ddlDatabases' is the name of combobox. And db.Name contains the name of the database
2 comments:
Great Code snippet,,,
Follow me and i will list ur site on my Blog,,,
thanks
http://techterabyte.blogspot.in/
Here is a database compatible with .NET, Silverlight, Windows Phone, Mono, Monodroid, and Monotouch:
http://www.kellermansoftware.com/p-43-ninja-net-database-pro.aspx
Post a Comment