SQL Server SMO complains of missing DLL(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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:SQL Server SMO 抱怨缺少 DLL
基础教程推荐
- 如何在 SQL Server 的嵌套过程中处理事务? 2021-01-01
- SQL Server 2016更改对象所有者 2022-01-01
- 在 VB.NET 中更新 SQL Server DateTime 列 2021-01-01
- SQL Server 中单行 MERGE/upsert 的语法 2021-01-01
- 无法在 ubuntu 中启动 mysql 服务器 2021-01-01
- 使用pyodbc“不安全"的Python多处理和数据库访问? 2022-01-01
- SQL Server:只有 GROUP BY 中的最后一个条目 2021-01-01
- 将数据从 MS SQL 迁移到 PostgreSQL? 2022-01-01
- ERROR 2006 (HY000): MySQL 服务器已经消失 2021-01-01
- Sql Server 字符串到日期的转换 2021-01-01