• Share this blog:



Database programming with  

  1. Generally, the output of the program will be stored in RAM.
  2. RAM is volatile, that is after every execution RAM memory will be cleared.
  3. To store the data permanently, .net is providing two ways
  • File handling
  • Database handling


Problems with File handling while storing real-time data:-

  101     teja             5000

102     raviteja         2000

102      Ravi              xyz

103       ravi             6000  

  1. The number of columns is not restricted.
  2. The type of data is not allowed.
  3. Possibility for data redundancy.
  4. Different to manipulate the data.
  5. No security for the data.

  Interested in mastering .NET? Learn more about ".NET Training" in this blog post.

  • To overcome these problems, ANSI introduced database concepts
  • A collection of interrelated data is called as databases are divided into three types


  • Create table EMP ( eno number, ename varchar 2 (10),…………..)
  • Create table XYZ

  ADO.NET (Active X Data objects for .net)  

  1. ADO.NET is an object library that is used to communicate with any database.
  2. Object library means a set of predefined class (a set of the namespace)
  3. ADO.NET is used to develop client Server Applications.


     C/S Architecture

  1. NET supports 2 types of connection


  1. Managed Connection
  2. Unmanaged Connection

 Managed connection:

Managed connections work with the help of the TDS  (Tabular data String) Protocol.  

Unmanaged Connection:

Unmanaged connections work with the help of OLEDB(object linking and Embedding   Databases ) provides.

  • OLEDB providers are DLL files, which are COM components As Com is platform-dependent, hence connection on OLEDB are called an Unmanaged connection.

Managed connections are faster in data accessing.


  1. To work with, Microsoft introduced System. Data Assembly, which contains 8  Namespaces.
  2. these Namespaces are divided into 5 Groups.

  Group 1:-

common namespace

  1. System. Data
  2. System.Data.Common
  1. System. Data. SQL Types 

  Group 2:-

Unmanaged Name Spaces 4.System. Data. OLEDB (Supports all type of databases)  

Group 3:-

Managed Namespaces

  1. System. Data. SQL client (SQL Server only)
  2. System. Data. oracle client (for oracle only ) (2.0)

  Group 4:-

ODBC Namespace

  1. System. Data. ODBC (supports all Databases)

  Group 5:-

LINQ Related Name Spaces

  1. System. Data. LINQ

Check Out .Net Tutorial

  EX 1:- With oracle over Unmanaged connection

  1. A program to create a table in oracle


A procedure to find provider names automatically.  

  1. Open notepad, save the file with the name

  “one. UDL” and close it File name        extension universal data Linker

  1. Double click on One .Udl file
  2. Select provider
  3. Choose “Micro-soft oledb provider for oracle ” and click Next
  4. Provide User name and password of oracle and click ok.
  5. Right-click on one.udl àopen with à note pad


  • Open WFAP
  • Place a button

  Using System. Data. Oledb;  

  • Code for Button 1 _click
    Oledb connection con  = new oledb connection  
    (“User id = Scott ; password = tiger; provider = msdaora.1”);
    Con. open ();
    Message Box .show  (“Connections is ok”);
    String q  = “Create Table c 194  (Eno number,  E name varchar 2 (10), Sql number)”;
    Oledb command cmd = new oledb command  (q, con);
    Try {
    cmd. Execute Non query ()
    Message Box. Show (“Table is created ”);
    Catch (oledb Exception oe)
    Message Box. Show  (oe. Message e );


Program to add records into c 194 table:-


Insert into c 194 value  (101, ‘Teja’, 5000)  

  • Open windows Forms Application Project
  • Design the form as shown Using System. Data . oledb
  • Code for Button 1_ click
String  s = “Insert in to c 194 values  (“ + text box1.Text  + “, ‘ “ + text box2. Text + “, ‘ “ + text box 3.text +”)”;

Message Box .show (s); Oledb _connection con = new loedb connection (“provider  = ms da or a.1 ; user id = scott;  password = tiger “);

Con. Open (); Oledb command cmd = new oledb command  (s, con);

cmd. Execute  Non query (); Message Box. Show (“Record is added”);


You liked the article?

Like : 0

Vote for difficulty

Current difficulty (Avg): Medium

Recommended Courses


About Author
Author Bio

TekSlate is the best online training provider in delivering world-class IT skills to individuals and corporates from all parts of the globe. We are proven experts in accumulating every need of an IT skills upgrade aspirant and have delivered excellent services. We aim to bring you all the essentials to learn and master new technologies in the market with our articles, blogs, and videos. Build your career success with us, enhancing most in-demand skills in the market.

Stay Updated

Get stories of change makers and innovators from the startup ecosystem in your inbox