all groups > sql server connect > november 2005 >
You're in the

sql server connect

group:

Connect


Connect William Stacey [MVP]
11/7/2005 10:13:14 PM
sql server connect:
How come I have to connect to my MSSQLSERVER instance using only "." or
"<hostname>", yet it does not work with ".\MSSQLSERVER"? Yet all other
instances require the host\instance format? This seems a bit strange and
inconsistent. Also, the common dialogs should be:
Server: <host>
Instance: <Instance>

So when you enter a server name, you can see instances in the drop down.
The connection object should work the same way:

Today:
ServerConnection conn = new ServerConnection();
conn.ServerInstance = "MSSQLSERVER";
conn.ConnectionString = "Server=localhost;Trusted_Connection=True;";

Would it not make more sense to be:
using(ServerConnection conn = new ServerConnection())
{
conn.Server = ".";
conn.Instance = "MSSQLSERVER";
conn.DatabaseName = "db1";
conn.Connect();
// use conn.
} // disconnect

And for static parse of conn string:
ServerConnection conn = ServerConnection.Parse(connString);
conn.Connect();

For that matter, why the connection object has connect and disconnect?
Connection object should just be passive meta data. A SqlServer object
should take a conn object and the SqlServer object should have the Connect()
and Disconnect() methods. At least that seems to make more sense to me.

--
William Stacey [MVP]


Re: Connect Brad Sarsfield [MSFT]
12/1/2005 10:52:51 AM
Hi William,

SMO probably shouldn't be allowing this if setting ServerInstance; it's
probably just stripping out MSSQLSERVER; SQL Native Client & SQLClient
definatly don't allow this.

The concept here is that the default instance is 'unnamed'. So you either
have a Named or Unnamed sql instance; MSSQLSERVER is the just the service
name here.

--
Brad Sarsfield [MSFT] bradsa(at)microsoft.com

This posting is provided "AS IS", with no warranties, and confers no rights.



[quoted text, click to view]

AddThis Social Bookmark Button