欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  数据库

命名空间"Microsoft.SqlServer"中不存在类型

程序员文章站 2022-05-29 08:43:34
...

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”(
是缺少程序集引用吗?)