OLEDB Connection and Command Class in C# .net
  • Share this blog:

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.

Do you want to enrich your career by learning .NET? Then Enroll in ".NET Training", this course will help you to boost your career.



  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.
Checkout our latest blog on .Net Tutorial

  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    

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