Question

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 there is any?

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

Thanks,

Was it helpful?

Solution

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++).

OTHER TIPS

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."

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top