SQL ADO.NET Objects Versus OleDb ADO.NET Objects

So what is the big difference? And why are there two different components to manipulate data?

The biggest difference is not apparent on the outside. It is inside where the differences are tremendous. If you look at how the two components differ, SQLClient is native to .NET and MS SQL Server. It communicates to SQL using its own protocol. This enables it to work more quickly and to avoid having to use the ODBC layer or OleDB to communicate to legacy database drivers.

When debugging, you need to keep in mind the difference between the two namespaces. Even though most of the features look and act alike, you might run into some problems. For instance, the connection strings differ slightly; if you are working with parameters, you need to make sure that you are formatting the string correctly.

When connecting to a Microsoft SQL Server database, you might want to increase your overall performance by using SqlDataAdapter along with its associated SqlCommand and SqlConnection.

Data Connection Performance Note

If you are concerned about performance, keep in mind the type of connection you will be using. When you are developing a database component, you might think about keeping it flexible enough to work on— say, with Oracle and SQL Server. To get the best performance, you could detect which database you are using and then use the classes that best suit your needs. This would fall under more of a commercial software product feature, but that is one bit of information to think about.


..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset