简体   繁体   English

C# SQL 连接 ODBC 或 OLEDB

[英]C# SQL connection ODBC or OLEDB

I'm supporting a legacy C# application which uses ADO.NET for data access.我支持使用 ADO.NET 进行数据访问的旧 C# 应用程序。 Today one of our client comes up with a different question今天我们的一位客户提出了一个不同的问题

Are you using OLEDB or ODBC for data connection?您是使用 OLEDB 还是 ODBC 进行数据连接?

From my understanding my code is using anyone of this driver but not sure how to confirm.根据我的理解,我的代码正在使用此驱动程序的任何人,但不确定如何确认。 Below is the code sample.下面是代码示例。 I'm using simple SQLConnection class but not sure how to identify the underlying driver.我正在使用简单的 SQLConnection 类,但不确定如何识别底层驱动程序。 Can someone help?有人可以帮忙吗?

 System.Data.SqlClient.SqlConnection conn=new System.Data.SqlClient.SqlConnection()
 conn.Open()

Please check this Microsoft documentation: https://docs.microsoft.com/en-us/dotnet/framework/data/adonet/ado-net-code-examples请查看此 Microsoft 文档: https : //docs.microsoft.com/en-us/dotnet/framework/data/adonet/ado-net-code-examples

As you can see, you are using SQLCLient, not OleDb or ODBC.如您所见,您使用的是 SQLCLient,而不是 OleDb 或 ODBC。

SQLClient is an specific data provider for SQL Server. SQLClient 是 SQL Server 的特定数据提供程序。 Also, you can check this link to learn a bit more about OLE DB and ODBC, and their differences: what is the difference between OLE DB and ODBC data sources?此外,您可以查看此链接以了解更多有关 OLE DB 和 ODBC 及其区别的信息: OLE DB 和 ODBC 数据源之间有什么区别?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM