0

I'm supporting a legacy C# application which uses ADO.NET for data access. Today one of our client comes up with a different question

Are you using OLEDB or ODBC for data connection?

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. Can someone help?

 System.Data.SqlClient.SqlConnection conn=new System.Data.SqlClient.SqlConnection()
 conn.Open()
Jay
  • 41
  • 7
  • I wonder why a customer needs to know this. – Alejandro Nov 06 '20 at 12:19
  • The answer to your client is simply no. You are not using OLDB or ODBC. `SqlClient` is a different driver (managed) and does not use either of those. – Dan Guzman Nov 06 '20 at 12:31
  • 1
    The .NET Framework Data Provider for SQL Server (SqlClient) uses its own protocol to communicate with SQL Server. It is lightweight and performs well because it is optimized to access a SQL Server directly without adding an OLE DB or Open Database Connectivity (ODBC) layer. https://learn.microsoft.com/en-us/dotnet/framework/data/adonet/data-providers#net-framework-data-provider-for-sql-server-sqlclient – lptr Nov 06 '20 at 12:58

1 Answers1

1

Please check this Microsoft documentation: https://learn.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 is an specific data provider for 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?

Dave Miller
  • 536
  • 3
  • 19
  • Make sense but my application is not working without OLEDB and ODBC driver. Any idea why this happning? – Jay Nov 06 '20 at 12:19
  • 2
    @Jay Your code don't uses neither OleDB or ODBC. If it fails, it must be in some other parts of your code. Look at the errors you get and you'll have an idea of where it uses them. – Alejandro Nov 06 '20 at 12:24
  • Hi, Jay. In this case, please, update your post, and add the information you consider important to give some context to undestand what's happening: which drivers you have installed -maybe the steps you followed through installation-, and as @Alejandro pointed, maybe you problem is some piece of code, so, please provide the specific error and the lines of code that are are producing it, so we can assist you. – Dave Miller Nov 06 '20 at 12:33