I am entering the source name userid and password through the textbox and want the database list should be listed on the combo box so that all the four options sourcename, u
Simply using GetSchema method:
GetSchema
using (SqlConnection connection = GetConnection()) { connection.Open(); DataTable dtDatabases = connection.GetSchema("databases"); //Get database name using dtDatabases["database_name"] }