Page 91 - DCAP312_WEB_TECHNOLOGIES_II
P. 91
Unit 5: Database Access
• Command Notes
• DataAdapter
• DataSet
A DataAdapter acts as a bridge between a data source and a data class which is disconnected
from the data source. It can provide a set of methods to carry out operations like Select, Insert,
Update and Delete. A DataSet is the equivalent for client side cursor, which holds a portion
of the database after execution of a query. It can be defined as a collection of DataRows and
DataColumns. More popularly known as an in-memory database.
There are four methods of executing a query in C#.
• ExecuteReader() – which will return the address of the cursor.
• ExecuteNonQuery() – which will return the number of rows affected.
• ExecuteScalar() – which will return the first [row][column] of the result.
• ExecuteXmlReader() – which will return the instance of an Xml Parser.
5.1 Database Access Using ADO.NET
A database is a collection of information that is prearranged so that it can easily be accessed,
managed, and updated. In one view, databases can be confidential according to types of satisfied:
bibliographic, full-text, numeric, and imagery.
In computing, databases are sometimes classified according to their organizational approach.
The most prevalent approach is the relational database, a tabular database in which data is
defined so that it can be reorganized and accessed in a number of different ways. A distributed
database is one that can be dispersed or replicated among different points in a network. An
object-oriented programming database is one that is congruent with the data defined in object
classes and subclasses.
5.1.1 ADO.NET
The ADO.NET is the new database technology of the .NET (DotNet) platform, and it builds
on ADO (ActiveX Data Objects). ADO is a language-neutral object representation that is the
keystone of Microsoft’s Universal Data admission approach. ADO.NET defines DataSet and
DataTable substance which are optimized for moving disengaged sets of data across intranets
and Internets, including through firewalls. It is also including the traditional Connection and
Command objects, as well as an object called a DataReader that resemble a forward-only, read-
only ADO record set.
If you create a new application your application require most of the time some form of data
access. ADO.NET provides data access services in the Microsoft .NET Platform.
You can use ADO.NET to access data by using the new .NET Framework data providers which are
• Data Provider for SQL Server(System.Data.SqlClient).
• Data Provider for OLEDB(System.Data.OleDb).
• Data Provider for ODBC(System.Data.Odbc).
• Data Provider for Oracle(System.Data.OracleClient).
The ADO.NET is a set of classes that expose data access services to the .NET developer. The
ADO.NET classes are found in System.Data.dll and integrated with XML classes in System.Xml.
dll.
LOVELY PROFESSIONAL UNIVERSITY 85