Home  >  Article  >  Database  >  命名空间"Microsoft.SqlServer"中不存在类型

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

WBOY
WBOYOriginal
2016-06-07 15:40:141042browse

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

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn