GetDatabases missing

Automate and integrate using the SQL comparison API

Moderator: Chris Auckland

GetDatabases missing

Postby aperregatturv » Tue Aug 05, 2008 2:44 pm

Hi

Currently, I am using SQL Tool kit 6 which has the following code.

RedGate.SQL.Shared.SQLServer.GetDatabases(s, false, UID, PWD, true);
to retrieve all the databases.

Now, I am looking for this code in SDK 7 and unable to find.

Please let me know where i can find this.

Thanks
aperregatturv
 
Posts: 48
Joined: Wed Aug 31, 2005 3:11 pm
Location: New York

Postby Brian Donahue » Tue Aug 05, 2008 3:58 pm

Hi,

I'm not sure that the SQLServer class is meant to be public, but I can tell you that it has moved to the RedGate.Shared.SQL.Server namespace. Quite a lot of RedGate.SQL.Shared has been shuffled around into different namespaces, so the next time you run into this problem, you may want to use Visual Studio's Object Explorer to search for the particular class you're looking for and find out where it's moved to.
Brian Donahue
 
Posts: 6669
Joined: Mon Aug 23, 2004 10:48 am

Postby aperregatturv » Tue Aug 05, 2008 4:06 pm

Brian,

Thanks for the reply. I already checked all the assemblies in the object Explorer before posting this.

This is what i see in SDK 7
RedGate.Shared.SQL.Server
SQLServerDiscoveryExecption
Base Types
Exception
ISerializable.

Please check again. I use that code in lot of places where database list is populated and I don't want to rewrite all over again. I hope you understand the difficulties what we face.

Thanks

Arun
aperregatturv
 
Posts: 48
Joined: Wed Aug 31, 2005 3:11 pm
Location: New York

Postby Brian Donahue » Tue Aug 05, 2008 4:14 pm

Hi Arun,

Ah I see. I don't think the GetDatabases method is static as in your example. I've got...
Code: Select all
 try
                {
                    if (checkBox1.Checked)
                        sqlServer = new SQLServer(true, comboBox2.Text, null, null);
                    else
                    {
                        // If SqlServer instance can't be initialized
                        // try, try again with SQL authentication
                        SqlAuthentication a = new SqlAuthentication(comboBox2.Text);
                        a.PasswordUpdate += new PasswordEventHandler(a_PasswordUpdate);
                        a.ShowDialog();
                    }
                }
                catch (Exception)
                {
                    // Could not Connect -- try SQL auth
                    SqlAuthentication a = new SqlAuthentication(comboBox2.Text);
                    a.PasswordUpdate += new PasswordEventHandler(a_PasswordUpdate);
                    a.ShowDialog();
                }
                try
                {
                comboBox1.DataSource = sqlServer.GetDatabases(true);
                }
                catch (System.Data.SqlClient.SqlException){}
Brian Donahue
 
Posts: 6669
Joined: Mon Aug 23, 2004 10:48 am


Return to SQL Comparison SDK Previous Versions

Who is online

Users browsing this forum: No registered users and 0 guests

cron