我有一个基于NAnt的脚本,我在连接到SQL Server 2008 Express的本地PC上运行,也在我的本地PC上运行,使用.sql文件删除和重新创建数据库 - 这很好用,这里没问题.
当我在另一台PC上重新创建相同的设置时出现问题,我在我的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()
Run Code Online (Sandbox Code Playgroud)
我在网上搜索过,发现在论坛中有人建议我需要安装Microsoft SQL Server Native Client,并从此URL获取.(不可否认,我只安装了Native Client部分) …