Skip to main content

ADO.NET Architecture

The ADO.NET Architecture consists of two major components:
1.      ADO.NET providers
2.      Datasets
ADO.NET Providers
·         The ADO.NET providers are responsible for transferring data between a database and a Visual Basic.NET application.
·         The Data Provider is responsible for providing and maintaining the connection to the database.
·         It is a set of classes that can be used for communicating with database, and holding/manipulating data.
·         The data provider connects to the data source on behalf of ADO.NET.
·         The data provider components are specific to data source.
·         There are two types of providers available in the ADO.NET model:

ü  SQL provider: Used for data transfer with SQL Server. The SQL server data-provider classes are present in the System.Data.SqlClient namespace.
ü  OLEDB provider:Used for data transfer with different kinds of database such as Oracle and MS Access. The OLEDB Data-provider classes are present in the System.Data.Oledb namespace. We can use OLE DB to connect Microsoft Access or Microsoft Excel frequently.
ü  ODBC: Used for data transfer with ODBC.  The ODBC data-provider classes are present in System.Data.OracleClient namespace.
The ADO.NET provider consists of the following components:
·         Connections: Used for establishing the connection to the data source.
·         Commands: Used for executing the commands on the data source.
·         Data Adapter: Used for populating the data from the data store into the dataset. (In short it is a bridge between Data source and Dataset object for transferring data.)


Connection Object
The connection object is used in Visual Basic .NET application to connect to the database. There are three types of connection objects available in VB.NET: SqlConnection, OledbConnection and ODBCConnection.
Commonly used properties of ADO.NET connection object
·         Connection String: The string that contains the text when the connection is established with any database.
·         Initial Catalog: The name of the database that will be used when the connection is established with any database.
·         DataSource:Used for defining the instance name of the database to which the connection is to be made.
Commonly used methods of connection object
·         Open: Used for opening the connection to any database. It does not take any parameter. The example for this method is: conn1.Open()
·         Close: Used for closing an existing connection of any database. It does not take any parameter. E.g., conn1.Close()

Command Object
It is used to store the command that needs to be executed on the database to which the connection is being established. It stores and executes the command for performing database manipulations.
Commonly used properties
·         CommandText: Stores the SQL command or the stored procedure name that is executed by the command object to manipulate or extract data from an SQL database.
·         CommandType:Stores the information about how the command text needs to be executed. For example, the common type property determines whether to execute the text in the command property as a table or as a stored procdedure.
·         Connection: Contains the name of the connection object used to connect to the database. E.g., SqlConnection, OledbConnection.

Commonly used methods of command object
·         ExecuteNonQuery: Used to execute the query specified in the command. It does not take any parameter. The example for this method is conn1.ExecuteNonQuery().
·         ExecuteReader:Used to execute the command specified when a datareader object is used or when a stored procedure needs to be executed using the command object.

Data Adapter
The DataAdapter should be used with the Dataset class for transferring data between the Visual Basic.Net application and the database. The Data adapter class is used for connecting and executing commands. The dataset object uses the methods and properties of the DataAdapter to transfer data between the dataset and the database.
Commonly properties
·         SelectCommand: Used to execute a select query on the database.
·         InsertCommand: Used to execute an insert query on the database.
·         UpdateCommand: Used to execute update query on the database.
·         DeleteCommand: Used to execute a delete query on the database.
·         TableMapping: Provides a mapping between the table and the dataset for representing the data as rows and columns in the dataset.
Common Methods
·         Fill: This method adds to or refreshes the data that matches with the data in the database. It requires the dataset name, which the adapter will refresh. E.g., DataAdapter1.Fill(dataset1)
·         Update: As the connection to the database is disconnected and needs to be updated when there are changes, this method needs to be explicitly invoked (call) to update the changes into the database after execution of the respective insert. E.g., DataAdapter1.Update(Dataset).


Note:

The second essential part of an architecture "Data sets" will be explained later. I request you not to skip this topic any how otherwise you won't be able to comprehend later part.

Edited By: Chaudhary Amit V.

Comments

Popular posts from this blog

Characteristics of a Good Programming Language

Till now there are many high level languages which are very popular, and there are others, which could not become so popular in-spite of being very powerful. There might be many reasons for the success of a language, but one obvious reason is the characteristics of the language. Several characteristics believed to be important with respect to making a programming language good are briefly discussed below. Simplicity A good programming language must be simple and easy to learn and use. For example, BASIC is liked by many programmers only because of its simplicity. Thus, a good programming language should provide a programmer with a clear, simple and unified set of concepts which can be easily grasped. It is also easy to develop and implement a compiler or an interpreter for a programming language that is simple. However, the power needed for the language should not be sacrificed for simplicity. The overall simplicity of a programming language strongly affects the readability of the pr...

Angular 4 and Firebase Authentication: Email/Password

In our  previous  article we saw how to create authentication module using Google identity provider. Now we will see how to implement Email and Password authentication using Firebase. We will use Bootstrap form to create intuitive user interface for sign-up and login using Email and Password. Step 1: Create signUp component. ng generate component signUp Step 2: Create custom form in sign-up.component.html file. The result of above code: Step 3: Add two functions for creating the user and login using Email and Password in src/app/providers/AFAuth.ts file. Step 4: Call createUserWithEmailAndPassword function in service from sign-up.component.ts. Step 5: Update routing configuration in app.module.ts  to include signUp component. Step 6: Update Login form to have Bootstrap form. The result of the above code. Step 7: Enable Email/Password component in Firebas...

Angular 4 and Firebase Authentication: Setup

If you have come to this article, it means you are keen to learn new technology and that too Firebase. I love Firebase because it provides all basic but important features of any web application. Take for example, authentication, which is cumbersome and risky if not implemented with utmost care. And when we have the integration of Angular and Firebase, it becomes a lot easier for a developer to build such crucial modules in less time with minimal efforts. In this article we will create a simple Angular application using Firebase. I am going ahead with the understanding that you know the benefits of Firebase and have little knowledge about it. There are plenty of posts out on the web if you are behind. Step 1: Install Angular CLI (if not installed). npm install -g angular-cli Step 2: Create new Angular 4 project. By default now angular CLI will create Angular 4 project so you need not fret. ng new firebase-authentication Step 3: Check whether the ne...