ado.net--Basic Concepts

Source: Internet
Author: User

Ado. The main objects in net:

    • Connection: Connection object. Used to establish a connection channel from the application to the database server specified database
    • Command: Commands object. Used to perform additions and deletions, such as database statement commands
    • DataReader: Data reader object. To return data line by row from the database
    • DataAdapter: Data adapter object. It encapsulates the batch return data, as well as the operation of adding and deleting data.
    • DataSet: Data set object. Used to return data from a database to multiple rows or even tables, as a database in memory
    • Parameter: Parameter object. The parameter is represented when a query with parameters is made, or when a stored procedure is called

Two modes of data access:

    • Lightweight: Connection + Command + DataReader
    • Weight level: Connection + DataAdapter + DataSet

   

Data provider:

    • To access a type of database, you need the provider of that database (Provider)
    • The. NET framework directly provides the following four types of provider:
      1. SQLClient: for accessing SQL Server
      2. OracleClient: for access to Oracle
      3. Odbcclient: Used to access ODBC data sources in an ODBC manner
      4. Oledbclient: For accessing data sources in OLE DB
    • Third-party database vendors often provide provider about their own databases. For example, Oracle provides PROVIDER,IBM for MySQL to provide provider for DB2.
    • For the provider that accesses SQL Server, the namespace and class name of the corresponding ADO:

ADO Object

Name space

Class name

Connection

System.Data.SqlClient

SqlConnection

Command

System.Data.SqlClient

SqlCommand

DataReader

System.Data.SqlClient

SqlDataReader

DataAdapter

System.Data.SqlClient

SqlDataAdapter

DataSet

System.Data

DataSet

Parameter

System.Data.SqlClient

SqlParameter

Database connection:

    • To access the database, you must first establish a connection object to the database. The most critical property of a Connection object is the connection string
    • Different types of databases, their connection strings are not the same
    • Typical SQL Server connection string notation:
      1. Connect to the database with a user name and password:
        SERVER=JOE-PC (database server name);d atabase=adventureworks_wroxssrs2012 (database name), Uid=sa (login name);p wd=root (password)
      2. Connect to the database with Windows authentication:
        SERVER=JOE-PC (database server name);d atabase=adventureworks_wroxssrs2012 (database name); Integrated security=true;

ado.net--Basic Concepts

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.