WHAT'S NEW?
Loading...

What is ADO.NET database programming in VB.NET?

Visual Basic.Net is a latest version of Microsoft that run dependent on the .NET Framework. All supported languages in .NET Framework share a common library. In the .NET Framework, the database API is ADO.NET that supports variety of Data Providers. These Providers composed of different kind of databases platforms (MSSQL, MSSQL, DB2, ORACLE, and MSACCESS) that can be use in any Microsoft related languages such as VB.NET, C#, C++, F#, and J# that enable to store data and performs SQL queries from database. ADO.NET stands for Active Data Objects .NET from its predecessor Data Access Object (DAO) , perhaps misnamed because it’s not an ActiveX/Component Object Model (COM) technology, the goal is to write high – performance, reliable, and scalable database for client - server applications both Desktop  and on the Web.

ADO.NET Framework can access any kind of data source, it’s a set of Object – oriented classes that provides a rich set of data components based on the ADO model and have some objects in common. To understand why ADO.NET was designed is because some developers not easy to program and some of them don’t have good enough performance. For instance, Open Database Connectivity (ODBC) Application Programming Interface (API) is a set of C functions. There is no object – oriented supports, the reason in developing applications using ODBC is because time – consuming process for developers and problematic in its relational natures, and limited support of relational databases. That’s why Microsoft introduced ADO high – level programming model that meets today’s programming and developer’s need (this was before ADO.NET), including disconnected data, tight integration with XML, and a common model work with all kinds of data sources.

The ADO.NET provides a Single Object – Oriented API set of classes. There are different data providers to work with different data sources, but the programming model for all these data providers work in the same way. Fortunately, if you know how to work with one data provider, you know already how to work easily with others. It’s just a matter of changing class names and connection strings. However, you can use more than one data provider to access a single data source. For example, you can use ODBC, MSSQL, or OleDb data providers to access Microsoft Access database because ADO.NET treats all databases in the same manner by using different data providers. The only difference is that you use different classes and connection strings to communicate databases, but it takes care for you under the hood. For instance, if you use the OleDb data provider (OLE stands for Object Linking and Embedding) to work with Access other OLE DB data sources, you use OleDbConnection, OleDbAdapter, and OleDbCommand objects. If you work with MSSQL Server, you use the Sql data provider’s classes SqlConnection, SqlDataAdapter, and SqlCommand. If you work with MySQL, you use MySqlConnection, MySqlDataAdapter, and MySqlCommand. All this commands work exactly in the same approach as the OleDb data provider’s classes. Classes are easy to use and to understand because of their Object – Oriented nature. One good thing to remember, if you know how to use these classes in Visual Basic.Net, you’ll have no problem to migrate using C#.

Understanding ADO.NET Components 
ado.net architecture

There are three (3) components to categorized ADO.NET.

Disconnected Component – A builds the basic ADO.NET architecture, these components (or class) with or without data providers.

Common or Shared – Are based on classes for data providers and shared by all data providers.

.NET Data Provider – Are specifically designed to work with different kinds of data sources. This composed of four sets components such as Connection, Command, DataAdapter, and DataReader.

Connection – The first component that talks to a data source and works as a connection reference in Command and DataAdapter objects.
Command – An object executes a SQL query and stored procedures to Select, Insert, Delete, and Update data of a data source via at DataAdapter.
DataAdapter – is a bridge between a DataSet and the connection to the data source. It uses Command objects to execute SQL queries and stored procedures.
DataReader – A method of a command object that executes the query and returns data in a DataReader object.

A DataSet objects falls in disconnected components series consists of a collection of tables, rows, columns, and relationships. It contains a collection of DataTables and the DataTable contain a collection of DataRows, DataRelations, and DataColumns. In addition, maps to a table in the database. Each DataRow can be accessed via an index, DataRelation can be accessed by its integrity, and DataColumn can be accessed by either an index or the column name. Moreover, DataSet act as a local copy of your database that has one – to – many relationships with DataTable. That means, it have one or more than one DataTable objects. Identically, a DataTable can have one or more than one DataRelation, DataRow, and DataColumn Objects.

This is the complete program in Visual Basic.Net Database programming with ADO.NET includes SELECT, INSERT, UPDATE, and DELETE statement.

0 comments:

Post a Comment