开发者

What is the difference between System.Data.SqlClient and SQLNCLI10.1 providers?

开发者 https://www.devze.com 2023-03-30 01:48 出处:网络
I\'m connecting my application to a SQL Server 2008 database. What is the difference between the following providers: System.Data.SqlClient provider and SQLNCLI10.1 if the开发者_Go百科re is any?

I'm connecting my application to a SQL Server 2008 database.

What is the difference between the following providers: System.Data.SqlClient provider and SQLNCLI10.1 if the开发者_Go百科re is any?

Which one should be used to connect to a SQL Server database and why?

Thanks,


System.Data.SqlClient is a managed provider. SQLNCLI is an OleDB provider. Which means they are as distinct as it gets. Nothing in common, really, besides the fact that they're both connecting to SQL Server. But using completely different and unrelated technologies. In your applications you should use SqlCLient when writing managed code (.Net). OleDB is for native applications (C++).


I would guess that the only difference is that the latter specifies a specific version (which may or may not be present as the code moves from server to server or the box is touched by software updates etc). The former just says "get the current version" and in my mind is safer.

Back in the classic ASP days I vaguely remember that specifying the most recent version explicitly (e.g. Provider=SQLOLEDB.1) seemed to work better than just Provider=SQLOLEDB but I don't recall the specifics. I do remember that some web hosts didn't have up to date stuff, and the explicit request for a more recent version would fail there with something similar to "provider not found."

0

精彩评论

暂无评论...
验证码 换一张
取 消