About OLEDB connection & command class in C# .net

16 October, 2020

Related Blogs

About OLEDB connection class :

  1. This class is used to open a connection with any type of database and also used to start transactions.
  2. This class is inherited from the System. Data. Common.Connection class,

Which is an abstract class.


AS per the above observations, all types of connection classes will be having the same method names and same property names.

These core tutorials will help you to learn the fundamentals of .NET. For an in-depth understanding and practical experience, explore Online ".NET Training"


  1. Status:
  2. Server version:
  3. Connection String:
  4. Provider:


  1. open ()
  2. close ()
  3. Dispose ()
  4. Begin Transaction

    Con. open (); Con . close (); Con.  Open ();

About oledb command class :

  • This class is used to execute DDL, DML, TCL, QL, and Stored procedures.

Check Out .NetTutorial

  DDL:  create, alter, drop DML:  insert, delete, update TCL: commit, rollback, savepoint QL: select   Stored Procedure is a collection of SQL Statements.  


  1. Connection
  2. Command Text
  3. Command Type
  4. Parameters


  1. Execute Non-Query ():- is used to execute DDL, DML, TCL, and stored procedure.
  2. Execute Reader (): need to be used when multiple records are expecting from a select statement.

Execute Reader ()   returns Data reader.

  1. Execute Scalar (): Search only for the first match, its match is found, then only the first column value will be returned.


  ENO           ENAME                   SAL

1                  Ravi                         5000

  1. Teja 9000
  2. Raj 8000
  4. .

1000   Select * from EMP ;

Execute Reader  () ALL

Execute Scalar ()  ALL