我有一个基于NAnt的脚本,在我的本地计算机上运行,连接到同样运行在我的本地计算机上的SQL Server 2008 Express,使用.sql文件来删除和重新创建数据库 - 这很好,没有问题。
当我在另一台计算机上重新创建了相同的设置时,我的NAnt脚本出现错误,提示:
System.InvalidOperationException: The 'SQLNCLI' provider is not registered on the local machine.
at System.Data.OleDb.OleDbServicesWrapper.GetDataSource(OleDbConnectionString constr, DataSourceWrapper& datasrcWrapper)
at System.Data.OleDb.OleDbConnectionInternal..ctor(OleDbConnectionString constr, OleDbConnection connection)
at System.Data.OleDb.OleDbConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningObject)
at System.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection(DbConnection owningConnection, DbConnectionPoolGroup poolGroup)
at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection)
at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)
at System.Data.OleDb.OleDbConnection.Open()
at NAnt.Contrib.Util.SqlHelper..ctor(String connectionString, Boolean useTransaction)
at NAnt.Contrib.Tasks.SqlTask.ExecuteTask()
at NAnt.Core.Task.Execute()
at NAnt.Core.Target.Execute()
at NAnt.Core.Project.Execute(String targetName, Boolean forceDependencies)
at NAnt.Core.Project.Execute()
at NAnt.Core.Project.Run()
我在网上搜索并发现在一个论坛中建议我需要安装 Microsoft SQL Server Native Client,可以在 这个网址 上下载。 (诚然,我只安装了其中的 Native Client 部分)
尽管在我的第二台计算机上已经安装了此软件,但脚本仍然给出相同的错误。有什么建议吗?