SQL Server SMO抱怨缺少DLL [英] SQL Server SMO complains of missing DLL
问题描述
我们在网络上有十几个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功能包,但仍然没有运气。
以下代码有效,除非我取消注释当前注释的行在这种情况下,我得到以下错误:
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;
服务器s =新服务器(conn);
数据库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版SMO组件,也许这是一个他们现在修复的错误。
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...
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();
}
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.
Note, I've also tried this from SSIS using VB.NET, same behavior.
Any thoughts would be appreciated.
Thanks.
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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!