通过ODBC驱动程序从dotnet连接sql server

时间:2013-02-12 06:53:46

标签: .net sql-server sql-server-2008-r2

让我们考虑以下通过odbc驱动程序连接sql server的连接字符串

"Driver={SQL Server Native Client 10.0};Server=xxx.xx.xx.xx,xxxx;Database=mydata;Uid=xx;Pwd=xxxxxx;"
运行此命令时

我收到错误

ERROR [08001] [Microsoft][SQL Server Native Client 10.0]Registry information is corrupt or missing. Make sure the provider installed and registered correctly.

ERROR [08001] [Microsoft][SQL Server Native Client 10.0]Client unable to establish connection

ERROR [08001] [Microsoft][SQL Server Native Client 10.0]A network-related or instance-specific error has occurred while establishing a connection to SQL Server. Server is not found or not accessible. Check if instance name is correct and if SQL Server is configured to allow remote connections. For more information see SQL Server Books Online.
2013-02-12 12:17:00,247 

ERROR    
Error at Executenonquery:ExecuteNonQuery: CommandText property has not been initialized

我也在该机器上启用了远程连接。

在当前机器中:visual studio已过期且sql server 2008 r2未安装。

我现在要做的就是解决问题

等待您的回复..

更新

当我在系统中的管理数据源[odbc]中注册驱动程序时,我收到了响应

Connection failed 

sqlsatte:'08001'

Sql Server Error:27

Registry information is corrupt or missing.

1 个答案:

答案 0 :(得分:0)

在我看来,您的SQL Native Client安装可能存在问题。查看安装/取消安装SQL Server Native Client的MSDN documentation以及应该能够在哪里找到已安装的文件。卸载并重新安装它可能是值得的。

一旦确定安装正常,请使用ODBC管理器工具(假设您使用的是XP)来设置和测试ODBC连接。

ODBC Admin window showing SQL Native Client 10 installation