Home >> SQL >> List All SQL Server Instances in Combo (Windows Form) – Part-2
SQL Browser

List All SQL Server Instances in Combo (Windows Form) – Part-2

Hello Friends,
On the Previous Post on this series, I have told you the code and procedure upto Connect Button. Hope you have been through it and enjoyed that. If not, please read below post before moving ahead.
Today, I am going to share rest of the Code for Listing Database, Tables Inside Database and Columns and apply them with Operator and simply perform Select Operation from database and list the Result in DataGrid. Let’s look the Design you have previously saw when making connection.
List All SQL Server
In above design,
In Database Combo, we will list all database from Connected Server. Then in Table Combo, we will list all Tables of Selected Database and in Column Combo all columns of Selected Table.

Lets Begin the Code. On Button Click and Successful Connection, we will load all database names in Database Combo. Actually we have did it earlier.
Lets have look at this Code:

This is code from earlier post.
Now Lets see the Code on SelectedIndex Change event of Database Combo (Combobox2).
Here we are creating Connection String Everytime, because, It is changing every-time. Now this code will list all the Tables inside Database in Table Combo (combobox3): Code:

Now above code will make all Columns of Selected table from database.
Now Directly move to Keyword TextBox textchange event which will load data as you type.

This will load data in GridView automatically. Lets see a snapshot once again with Result.

List All SQL Server
All the Best, Enjoy….

About John Bhatt

Aka, Prithvi Raj Bhatt, A Proud Nepali, Blogger, Software Developer, ASP.NET, Web Designer & Developer, Faculty and a Troubleshooter blog @PRsBlog

Leave a Reply

Your email address will not be published. Required fields are marked *