时间:2021-07-01 10:21:17 帮助过:17人阅读
using System; using Microsoft.SqlServer.Management.Smo; using Microsoft.SqlServer.Management.Common; namespace DAL { public class SMODemo { public static void Main() { ServerConnection conn = new ServerConnection(); conn.LoginSecure = fals
using System;
using Microsoft.SqlServer.Management.Smo;
using Microsoft.SqlServer.Management.Common;
namespace DAL
{
public class SMODemo
{
public static void Main()
{
ServerConnection conn = new ServerConnection();
conn.LoginSecure = false;
conn.Login = "userName";
conn.Password = "password";
Server svr = new Server(conn);
Console.WriteLine(svr.Name + " " + svr.Information.VersionString);
}
}
}
编译时有下面的错误:怎么解决呢?
SMODemo.cs(4,27): error CS0234:
命名空间“Microsoft.SqlServer”中不存在类型或命名空间名称“Management”(
是缺少程序集引用吗?)
SMODemo.cs(5,27): error CS0234:
命名空间“Microsoft.SqlServer”中不存在类型或命名空间名称“Management”(
是缺少程序集引用吗?)