SQL Server SMO 抱怨缺少 DLL

2023-11-28数据库问题
7

本文介绍了SQL Server SMO 抱怨缺少 DLL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

问题描述

好的,我已经浏览了网络、BOL、各种论坛,但我离答案还很远……希望你们这些好人能伸出援手……

Ok, I've scoured the web, BOL, various forums and I'm no closer to an answer...hopefully you fine folks can lend a hand...

我们在网络上有十几个 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 的站点下载了包含 SMO 对象的 SS2005 功能包,但仍然没有成功.

We've got a dozen or so SQL Servers (some 2k, some 2005) on a network. I'm using SMO objects in a .NET application to get some standard information. My problem appears to boil down to a missing DLL - Microsoft.SqlServer.BatchParser.dll. However, this DLL did not come with the other SQL DLLs (Microsoft.SqlServer.ConnectionInfo.dll, Microsoft.SqlServer.Smo.dll, Microsoft.SqlServer.SmoEnum.dll, Microsoft.SqlServer.SqlEnum.dll, etc...). I also downloaded the SS2005 feature pack from Microsoft's site that includes the SMO objects, but still no luck.

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

The following code works, unless I uncomment the line that is currently commented, in which case I get the error below:

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,版本=9.0.242.0,文化=中性,PublicKeyToken=89845dcd8080cc91"或其依赖项之一.系统找不到指定的文件.

Error: Could not load file or assembly 'Microsoft.SqlServer.BatchParser, Version=9.0.242.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91' or one of its dependencies. The system cannot find the file specified.

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

Note, I've also tried this from SSIS using VB.NET, same behavior.

如有任何想法,我们将不胜感激.

Any thoughts would be appreciated.

谢谢.

推荐答案

我能够使用 10.* 版本的程序集Microsoft.SqlServer.ConnectionInfo"、Microsoft.SqlServer.Management.Sdk"成功运行您的代码.Sfc"和Microsoft.SqlServer.Smo".尝试下载 2008 版 SMO 组件,也许这是一个他们现在已经修复的错误.

I was able to successfully run your code using the 10.* versions of the assemblies "Microsoft.SqlServer.ConnectionInfo", "Microsoft.SqlServer.Management.Sdk.Sfc" and "Microsoft.SqlServer.Smo". Try downloading the 2008 version of the SMO components, maybe it was a bug that they've now fixed.

这篇关于SQL Server SMO 抱怨缺少 DLL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

The End

相关推荐

按天分组的 SQL 查询
SQL query to group by day(按天分组的 SQL 查询)...
2024-04-16 数据库问题
77

SQL 子句“GROUP BY 1"是什么意思?意思是?
What does SQL clause quot;GROUP BY 1quot; mean?(SQL 子句“GROUP BY 1是什么意思?意思是?)...
2024-04-16 数据库问题
62

在 Group By 查询中包含缺失的月份
Include missing months in Group By query(在 Group By 查询中包含缺失的月份)...
2024-04-16 数据库问题
12

sql group by 与不同
sql group by versus distinct(sql group by 与不同)...
2024-04-16 数据库问题
37

如何在SQL中返回每个组的增量组号
How to return a incremental group number per group in SQL(如何在SQL中返回每个组的增量组号)...
2024-04-16 数据库问题
8

统计分组返回的记录数
Count number of records returned by group by(统计分组返回的记录数)...
2024-04-16 数据库问题
10