0

Good morning Guys,

I've got this code currently running:

        private void button1_Click(object sender, EventArgs e)
        {
            SqlDataSourceEnumerator sdse = SqlDataSourceEnumerator.Instance;
            DataTable table = sdse.GetDataSources();
            foreach (DataRow row in table.Rows)
            {
                instanceCombobox.Items.Add(row["ServerName"].ToString() + "\\" + row["InstanceName"].ToString());
            }

Which gives me the Instance and Name of the SQL Server over the Network.

I'm now looking to Cycle through available databases on the 'Selected' Instance. Ideally the Databases for the 'Selected' Instance in the 'Top Combo Box' would be in a seperate 'ComboBox.

I checked the Databale through debug but the information is not held there so cannot call it.

Any help would be great.

Regards
Mark.

3
Contributors
2
Replies
15
Views
4 Years
Discussion Span
Last Post by TnTinMN
0

You'll need to connect to the selected instance and run the sp_databases stored procedure (assuming you have the priviliges to do so).

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.