sql-server – SQL Server SMO抱怨缺少DLL

好的,我已经扫过网络,BOL,各种论坛,我没有接近一个答案…希望你很好的人可以借一只手…

我们在网络上有十几个sql Server(大约2k,一些2005).我在.NET应用程序中使用SMO对象来获取一些标准信息.我的问题似乎归结为一个缺少的DLL – Microsoft.sqlServer.BatchParser.dll.但是,这个DLL没有附带其他sql DLL(Microsoft.sqlServer.ConnectionInfo.dll,Microsoft.sqlServer.Smo.dll,Microsoft.sqlServer.SmoEnum.dll,Microsoft.sqlServer.sqlEnum.dll等) .我也从Microsoft的网站下载了SS2005功能包,其中包括SMO对象,但仍然没有运气.

以下代码有效,除非我取消注释当前注释的行,在这种情况下,我会收到以下错误

protected void btnArchive_Click(object sender,EventArgs e)
{
    ServerConnection conn = new ServerConnection("my_server");

    conn.LoginSecure = false;
    conn.Login = "my_login";
    conn.Password = "my_password";

    Server s = new Server(conn);
    Database d = s.Databases["my_database"];
    //Table tbl = d.Tables["my_table"];

    Response.Write(s.Name + " " + s.information.RootDirectory + " " + d.CreateDate.ToShortDateString());
    conn.disconnect();
}

错误
无法加载文件或程序集“Microsoft.sqlServer.BatchParser,Version = 9.0.242.0,Culture = neutral,PublicKeyToken = 89845dcd8080cc91”或其依赖项之一.该系统找不到指定的文件.

注意,我也使用VB.NET尝试从SSIS,同样的行为.

任何想法都不胜感激.

谢谢.

解决方法

我可以使用10.x版本的程序集“Microsoft.sqlServer.ConnectionInfo”,“Microsoft.sqlServer.Management.Sdk.Sfc”和“Microsoft.sqlServer.Smo”来成功运行代码.尝试下载 2008 version of the SMO components,也许这是一个他们现在修复的错误.

相关文章

SELECT a.*,b.dp_name,c.pa_name,fm_name=(CASE WHEN a.fm_n...
if not exists(select name from syscolumns where name=&am...
select a.*,pano=a.pa_no,b.pa_name,f.dp_name,e.fw_state_n...
要在 SQL Server 2019 中设置定时自动重启,可以使用 Window...
您收到的错误消息表明数据库 'EastRiver' 的...
首先我需要查询出需要使用SQL Server Profiler跟踪的数据库标...