![]()
Article posted by Vuyiswamb on 7/22/2008 | Views: 7794 | Category: ADO.NET | Level: Beginner
If you found plagiarised (copied) or inappropriate content, please let us know the original source along with your correct email id (to communicate) for further action.
To my surprise, there are still software development houses that still initiate Development using languages like VB6 and obviously using ADO. In most of the time when someone has a Problem about ADO, I fail to referrer them to an article about Introduction to ADO.NET. So I thought I should write one that will tell them how great it is to build Applications in .NET and ADO.NET is the best thing that has ever happened to Database Programming. In this Article, we are going to introduce those who are still experiencing ADO Problems to .Net.
IntroductionTo my Surprise there are still vb6 Guru who are not willing to let go of VB6. Well talking from experience, I have to suffer the results of it in the future, because of the saying that goes by “If its working, Do not Fix it”, I recently had a vb6 Application, obviously not written by me.I don’t associate myself with those type of applications by trying to fix a vb6 code. The Application will break; you will get Sql timeouts and all the errors you can imagine.
ADO.NET presents us with what I call “Resource Saver”, that means your application does not always need to be connected to the SQL Server to work. Look at it as disconnected recordset. that means your application will just request the Data and Store them in the Cache and Disconnect from the SQL Server and the user will continue to work, when done and needs to update the data, then the connection will be established with the server and the Update will be done and again there will be a disconnection from the server to save resources. See that’s easy and its saving a lot of resources.
The Story Continues
For the Past Decades the way Applications access data has changed repeatedly. Programmers moved from Simple Client Applications that use local Database’s to a distributed system that uses a centralized databases. If you worked with Languages like vb6 or java you will know that there was something like ADO, ODBC, RDO and RDS. Well they had their good times and I personally preferred ADO, because there was nothing that looked better than it. When Microsoft introduced ADO.NET, I thought I was dreaming I ran straight to the Bookstore and Look a Book in ADO.NET; it was like a newspaper to me. “Was it true that Microsoft created disconnected recordset technology?” Well it was true. In .NET we have ADO.NET.
ADO.NET
Ado.net consists of classes that allow a .NET application to connect to the data source, executes commands and manage disconnected data. One of the key Differences between ADO.NET and other database technologies is how it deals with Challenge with different data sources, that means, the code you use to connect to an SQL Database will not differ that much to the one connecting to an Oracle Database. In many previous database technologies like ADO, a programmer had to use generic set of objects, no matter what the underlying data source is. That means if you have a Data layer, your Dal(Data Access Layer) Class can be used on Both Oracle and SQL, so there is nothing to change, but now in .NET it’s a Different Story, Ado.net uses provider model, that means I cannot connect to a SQL database with a OleDb Provider or Oracle Provider. What are providers? Data Providers as a set of ADO.NET Classes that allows you to access certain databases execute commands, retrieve data and more. So that means in order to connect to the SQL database you need to have a Provider of “SQltype” SQLClient. The Data Provider is a Middle man or a Bridge between your Database and your Application. The Data Provider is made up of the Following Classes.
Connection – we use this to establish a connection to the Data Source, that’s where you will pass your constructor with a connection string.
Command - We use the command object to execute the commands and storedprocedures.
Datareader - A datareader is a read only, forward only access to the data retrieved from a query and its normally used on read only data, or to Populate Comboboxes and more.
DataAdapter - This object performs two tasks, we use it to fill the Dataset (Disconnected Recordsets as I call it, but this one is powerful it carries a tables, that means a Dataset can contain many tables.)And another thing you can do with the adapter is to make changes to the Data, by first Connecting to the Datasource and making Changes.
Each Data provider has a specific implementation of Connection, Command and Adapter. That means if you need to a SQl database, you should use SQLConnection Class.
Conclusion
My Advice to those who are not yet in .NET is that, you buy a Book in .NET. well I have some Good Books you can get from Apress by Matthew MacDonald and Mario Szpuszta. Get some online training at www.itfunda.com. But for now its time for you to rush to a Book store and move to .NET
That was short J
Thank you
If you like this article, subscribe to our RSS Feed. You can also subscribe via email to our Interview Questions, Codes and Forums section.

Found interesting? Add this to:
|
Please Sign In to vote for this post.
|
Latest Articles from Vuyiswamb
| Experience: | 11 year(s) | | Home page: | http://www.Dotnetfunda.com | | Member since: | Sunday, July 06, 2008 | | Level: | NotApplicable | | Status: | [Member] [MVP] [Administrator] | | Biography: | Vuyiswa Junius Maseko is a programmer and a moderator in ".NetFunda. Vuyiswa has been developing for 9 years now. his major strength are C# 1.1,2.0,3.0,3.5 and sql and his interest are in Silverlight,WPF,C#,Kinect , Xbox Gaming Dev. |
Responses |
Posted by: Raja | Posted on: 22 Jul 2008 02:53:25 PM Thanks for a great introduction about ADO.NET. For those who are looking for free ADO.NET Ebooks may download it from http://www.free-ebooks-download.org/free-ebook/dotnet/ADO.NET/
Thanks and keep it up Vuyiswa.
|
Posted by: Bhupentiwari | Posted on: 26 Jun 2012 04:04:58 AM | Points: 25 good articles
|
This article will give you the overview of how to copy data from one table to another by using ado.net sqlbulkcopy classes.
To efficiently write the code of Data Access Layer we must be aware about the functionality/features of DataSet, SqlDataReader and XmlReader. In this article, I am trying to describe which objects fits in what scenario.
DataTableReader is a very useful ADO.NET class that can be used to retrieve / pass the data between layers in readonly and forward only format. In this article, I shall discuss about the DataTableReader class. Its very useful but perhaps rarely used in everyday programming even if it is best suitable in passing data between layers in place of DataTable.
In this article, we will earn how to get the value from output parameter in C# which is returned by stored procedure; also we will see how to get the newly inserted record’s Incremented PK value using output parameter. In this article we used @@Identity sql server variable which tracks the incremented value on the table.
In this article, we shall learn how to insert records into the SQL Server database.
More ...
|
|