从 C# 通过 ODBC 访问 Sql Server:错误 [IM002] [Microsoft][ODBC 驱动程序管理器] 未找到数据源名称且未指定默认驱动程序 [英] Access to Sql Server via ODBC from C# : ERROR [IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
问题描述
我配置了系统 DSN 并且测试正常:
I have a System DSN configured and test ok :
Microsoft SQL Server 本机客户端版本 10.00.2531
Microsoft SQL Server Native Client Version 10.00.2531
数据源名称:xxx 数据源
Data Source Name: xxx Data Source
描述:xxx 服务器:SERVER\SHARE
Description: xxx Server: SERVER\SHARE
使用集成安全:是数据库:
Use Integrated Security: Yes Database:
yyy 语言:(默认)数据
yyy Language: (Default) Data
加密:无信任服务器
证书:没有多个活动结果
Certificate: No Multiple Active Result
Sets(MARS):无镜像服务器:
Sets(MARS): No Mirror Server:
翻译字符数据:是日志长
Translate Character Data: Yes Log Long
运行查询:无日志驱动
统计:不使用区域设置:
Statistics: No Use Regional Settings:
不使用 ANSI 引用标识符:是
No Use ANSI Quoted Identifiers: Yes
使用 ANSI Null、填充和警告:
Use ANSI Null, Paddings and Warnings:
是的
我在 Windows 7 64 位上工作.在 x86 模式下运行的代码.
I work on a windows 7 64 bits. The code in running in x86 mode.
在 Excel 中,我只能连接到用户 DSN,没有出现系统 DSN.我也尝试过使用 DSN,它在 excel 中有效,但在 c# 中无效
In Excel, I can connect only to User DSN, the System DSN does not appear. I tried also a use DSN, It works in excel but not in c#
我将 ODBC 的权限更改为 regedit 中的每个人.
I changed the permissions for the ODBC to everyone in regedit.
我在 c# 代码中使用这个连接字符串:Data Source=xxx;Initial Catalog=yyy;Integrated Security=SSPI;
I use this connectionstring in the c# code : Data Source=xxx;Initial Catalog=yyy;Integrated Security=SSPI;
我有此错误:错误 [IM002] [Microsoft][ODBC 驱动程序管理器] 未找到数据源名称且未指定默认驱动程序
I have this error : ERROR [IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
有什么想法吗?
提前致谢
推荐答案
我实现了使用该连接字符串连接到没有 ODBC 的数据库:
I achieved to connect to the database without ODBC with that connection string:
Driver={SQL Server Native Client 10.0};Server=xxx;Database=zzz;Trusted_Connection=yes;
谢谢!
这篇关于从 C# 通过 ODBC 访问 Sql Server:错误 [IM002] [Microsoft][ODBC 驱动程序管理器] 未找到数据源名称且未指定默认驱动程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!