mobileNavlogo
headerlogo

About OLEDB connection & command class in C# .net

16 October, 2020

Ratings

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.

Screenshot_19

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"

Properties:-

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

Methods:-

  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.  

Properties:-

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

Methods:-

  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.

  EMP 

  ENO           ENAME                   SAL

1                  Ravi                         5000

  1. Teja 9000
  2. Raj 8000
  3.  
  4. .

1000   Select * from EMP ;

Execute Reader  () ALL

Execute Scalar ()  ALL    

About Author
Authorlogo
Name

TekSlate

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 .