[英]Access to Sql Server via ODBC from C# : ERROR [IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
I have a System DSN configured and test ok : 我已经配置了系统DSN并测试ok:
Microsoft SQL Server Native Client Version 10.00.2531
Microsoft SQL Server本机客户端版本10.00.2531
Data Source Name: xxx Data Source
数据源名称:xxx数据源
Description: xxx Server: SERVER\\SHARE
说明:xxx服务器:SERVER \\ SHARE
Use Integrated Security: Yes Database:
使用集成安全性:是数据库:
yyy Language: (Default) Data
yyy语言:(默认)数据
Encryption: No Trust Server
加密:无信任服务器
Certificate: No Multiple Active Result
证书:无多个有效结果
Sets(MARS): No Mirror Server:
集(MARS):无镜像服务器:
Translate Character Data: Yes Log Long
翻译字符数据:是长时间登录
Running Queries: No Log Driver
运行查询:无日志驱动程序
Statistics: No Use Regional Settings:
统计信息:否使用区域设置:
No Use ANSI Quoted Identifiers: Yes
否使用ANSI引用标识符:是
Use ANSI Null, Paddings and Warnings:
使用ANSI空值,填充和警告:
Yes
是
I work on a windows 7 64 bits. 我在Windows 7 64位上工作。 The code in running in x86 mode.
在x86模式下运行的代码。
In Excel, I can connect only to User DSN, the System DSN does not appear. 在Excel中,我只能连接到用户DSN,而不会出现系统DSN。 I tried also a use DSN, It works in excel but not in c#
我也尝试过使用DSN,它可以在excel中工作,但不能在c#中工作
I changed the permissions for the ODBC to everyone in regedit. 我将ODBC的权限更改为regedit中的每个人。
I use this connectionstring in the c# code : Data Source=xxx;Initial Catalog=yyy;Integrated Security=SSPI; 我在c#代码中使用以下连接字符串:数据源= xxx;初始目录= yyy;集成安全性= SSPI;
I have this error : ERROR [IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified 我遇到此错误:错误[IM002] [Microsoft] [ODBC驱动程序管理器]找不到数据源名称,并且未指定默认驱动程序
Any idea ? 任何想法 ?
Thanks in advance 提前致谢
I achieved to connect to the database without ODBC with that connection string: 我实现了使用该连接字符串连接到不使用ODBC的数据库:
Driver={SQL Server Native Client 10.0};Server=xxx;Database=zzz;Trusted_Connection=yes;
Thanks ! 谢谢 !
he initial problem posted here is most likely due to the fact that a 64bit ODBC Data Source has been created (using the ODBC Administrator via the Control Panel) and the app is only 32bit. 此处发布的最初问题很可能是由于已经创建了64位ODBC数据源(通过“控制面板”使用ODBC管理器)并且该应用程序仅为32位。
Put another way -- 换一种方式 -
32bit apps require 32bit ODBC Drivers and 32bit DSNs (C:\\Windows\\SysWOW64\\odbcad32.exe) 32位应用程序需要32位ODBC驱动程序和32位DSN(C:\\ Windows \\ SysWOW64 \\ odbcad32.exe)
64bit apps require 64bit ODBC Drivers and 64bit DSNs (C:\\Windows\\System32\\odbcad32.exe) 64位应用程序需要64位ODBC驱动程序和64位DSN(C:\\ Windows \\ System32 \\ odbcad32.exe)
32 and 64bit components CANNOT be interchanged here!! 32位和64位组件在这里不能互换!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.