Red Gate forums :: View topic - GetDatabases missing
Return to www.red-gate.com RSS Feed Available

Search  | Usergroups |  Profile |  Messages |  Log in  Register 
Go to product documentation
SQL Comparison SDK Previous Versions
SQL Comparison SDK Previous Versions forum

GetDatabases missing

Search in SQL Comparison SDK Previous Versions forum
Post new topic   Reply to topic
Jump to:  
Author Message
aperregatturv



Joined: 31 Aug 2005
Posts: 48
Location: New York

PostPosted: Tue Aug 05, 2008 2:44 pm    Post subject: GetDatabases missing Reply with quote

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
Back to top
View user's profile Send private message
Brian Donahue



Joined: 23 Aug 2004
Posts: 6577

PostPosted: Tue Aug 05, 2008 3:58 pm    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
aperregatturv



Joined: 31 Aug 2005
Posts: 48
Location: New York

PostPosted: Tue Aug 05, 2008 4:06 pm    Post subject: Reply with quote

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
Back to top
View user's profile Send private message
Brian Donahue



Joined: 23 Aug 2004
Posts: 6577

PostPosted: Tue Aug 05, 2008 4:14 pm    Post subject: Reply with quote

Hi Arun,

Ah I see. I don't think the GetDatabases method is static as in your example. I've got...
Code:
 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){}
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic All times are GMT + 1 Hour
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group