【发布时间】:2010-11-11 08:00:39
【问题描述】:
我正在使用来自 Microsoft.SqlServer.Management.Smo 命名空间的 Server 对象。
我如何检查它是否成功连接到服务器,但我看不到任何与之相关的属性。
ServerConnection srvConn = new ServerConnection(server);
// Log in using SQL authentication instead of Windows authentication
srvConn.LoginSecure = false;
// Give the login username
srvConn.Login = serverUserName;
// Give the login password
srvConn.Password = serverPassword;
// Create a new SQL Server object using the connection we created
SqlServer = new Server(srvConn);
我想知道我的用户名和密码连接是否良好。
感谢您的帮助。
【问题讨论】:
标签: c# .net sql-server sql-server-2005 smo