5.Database Programming

In this tutorial, Database programming using VC# .NET and OleDb is explained using Student Database example. The program uses MS Access as the back end. A basic understanding of Structured Query Language (SQL) is assumed. After going through this video, the student is advised to complete the whole program of Student Database (Assignment). 


Most applications require some form of data access. If you are creating a new application, you have three excellent data access choices: ADO .NET, ADO, and OLE DB.



ADO .NET is the strategic application-level interface for providing data access services in the Microsoft .NET Platform. You can use ADO .NET to access data sources using the new .NET Framework data providers.



For applications written in native code, ADO provides a COM-based application level interface for OLE DB data providers.



OLE DB is the strategic system-level programming interface for accessing data, and is the underlying technology for ADO as well as a source of data for ADO .NET. OLE DB is an open standard for accessing all kinds of data — both relational and non-relational data OLE DB provides consistent, high-performance access to data and supports a variety of development needs, including the creation of front-end database clients and middle-tier business objects using live connections to data in relational databases and other stores.


Choosing OLE DB

The choice to write to OLE DB directly must be evaluated against using an easier data access method such as ADO .NET or ADO. The factors affecting your decision to use OLE DB's COM-level data access include:

    Performance   Both ADO .NET and ADO are very fast, but they do insert an extra layer of abstraction  between your application and the data provider when working with OLE DB data sources.

    Functionality   OLE DB defines native interfaces designed to be extensive and extensible enough to expose all of a database's underlying behavior, semantics and functionality.

    Maintenance   Using the OLE DB data access technology affects the cost of long-term maintenance for your application.


The System.Data.OleDb namespace is the .NET Framework Data Provider for OLE DB.

The .NET Framework Data Provider for OLE DB describes a collection of classes used to access an OLE DB data source in the managed space. Using the OleDbDataAdapter, you can fill a memory-resident DataSet, which you can use to query and update the data source.

Some of the classes in the System.Data.OleDb namespace are:


Represents an SQL statement or stored procedure to execute against a data source.


Represents an open connection to a data source.


Represents a set of data commands and a database connection that are used to fill the DataSet and update the data source.


Provides a way of reading a forward-only stream of data rows from a data source. This class cannot be inherited.

For more information refer MSDN. Click on the appropriate link below to see the video and the source.

Database Programming using VC#



Download the source code Database Programming Example


Site optimized for IE6 and above. Copyright © 2010. Site Developed Using KTS WebCloud