Introduction To Database Programming

In any programming language Database Programming is very essential part of it. In here you can implement your database with a single computer or within a client server system. When you are working with a stand alone pc, it is very easy to maintain the program. But when work with client server environment, database programming is little bit difficult to handle comparing with previous one.

When you are working with client server environment you must have good database management like SQL Server, My SQL, or Oracle. This DBMS manage the database that is stored in the server. When comparing with the client server with stand alone systems, client server systems need additional preparations for the tasks. Although the application software is running on the client, it uses data that stored on the server. To make this conversion with the client and the data source is possible for VB application.

The client access the database, where the data access API such as ADO.Net. Once the software for both client and server are installed, the client communicates with the server by passing SQL quarries to the DBMS through the data access API. These quarries are written in standard language like SQL. SQL lets any application to communicate with any DBMS. After implementing the SQL in the server side, the result again passed into the client for required activities.

ActiveX Data Object (ADO)

ADO.Net is the primary data access API for the .Net framework. It provides the class that you use to develop database application as well as other .Net languages. This class can be divided into two categories.

They are:

      • .Net data providers
      • Data sets

The .Net Data Providers

Those who provide the classes that you use to access the data in the database. There having four major types of objects as follows.

Object

Description

Connection Object

Establish the connection to database

Command Object

Represent an Individual SQL statement that can be executed against the database

Data Provider

Provide read only, forward only objects to access the data in an object

Data Adapter

Provides the link between command & connection objects and data set objects

When you are working with the specific DBMS, you have to choose correct data providers to implement your required operations. When you are working with SQL server database, you have to choose SQL data provider and you can use OLEDB provider as a generic data provider for any database that supports the industry standard OLEDB (Object Linking and Embedding Data Base) interfaces. As well you can use ODBC provider for any database which supports and work with any ODBC support database.

As well the following table shows what are the available data providers and their namespaces.

Provider

Namespace

Description

SQL Server

System.data.SQLclient

Lets you to access SQLServer databases

OLEDB

System.data.OLEDB

Lets you to access any OLEDB support Database

ODBC

System.data.ODBC

Lets you to access any ODBC support Database

ORACLE

System.data.ORACLEclient

Lets you to access ORACLE databases

When you are developing database applications using ADO.Net you will want to add and imports particular namespaces that contains proper data provider classes. At the beginning each source file you have to use those required classes by using following code statements.

Imports System.Data.[namespace/provider name]

In our case we are using SQL servers as the back end. Therefore the statements as follows:

Imports System.Data.SQLclient