Presentation is loading. Please wait.

Presentation is loading. Please wait.

Overview of ADO.NET Chapter 1 ADO.NET 4.0 Development.

Similar presentations


Presentation on theme: "Overview of ADO.NET Chapter 1 ADO.NET 4.0 Development."— Presentation transcript:

1 Overview of ADO.NET Chapter 1 ADO.NET 4.0 Development

2 2 Contents What is ADO.NET? The evolution of ADO to ADO.NET SQL Server data provider OLE DB data provider ODBC data provider Oracle data provider Type mappings

3 3 What is ADO.NET? Microsoft's database API for the Internet era Core classes are in System.Data namespace Four data providers supported SQL Server data provider OLE DB data provider ODBC data provider Oracle data provider There are 3 usage styles in ADO.NET ADO.NET connected model ADO.NET disconnected model LINQ to SQL and/or ADO.NET Entity Framework

4 4 The Evolution of ADO to ADO.NET ADO.NET is significantly different than ADO To improve flexibility, scalability, and performance The following diagram shows how objects in ADO map to equivalent objects in ADO.NET ConnectionXxxConnection CommandXxxCommand RecordSet XxxDataReader DataSet XxxDataAdapter ADOADO.NET

5 5 SQL Server Data Provider Optimised access to SQL Server 7.0 upwards, and for the Microsoft Data Engine (MSDE) Uses lightweight Tabular Data Stream (TDS) protocol to communicate efficiently with SQL Server Use the System.Data.SqlClient namespace, which includes the following classes: SqlConnection (connect to database) SqlCommand (execute SQL statement/stored proc) SqlDataReader (fast forward-only cursor over data) SqlDataAdapter (useful in disconnected apps)

6 6 OLE DB Data Provider Access to data sources that have an OLEDB data provider, such as SQL Server 6.5 and Access Uses native OLE DB and COM interoperability to connect and communicate with a data source Use the System.Data.OleDb namespace, which includes the following classes: OleDbConnection (connect to database) OleDbCommand (execute SQL cmd/stored proc) OleDbDataReader (fast forward-only cursor) OleDbDataAdapter (useful in disconnected apps)

7 7 ODBC Data Provider Access to data sources that have an ODBC driver Only use this approach as a last resort! Use the System.Data.Odbc namespace, which includes the following classes: OdbcConnection (connect to database) OdbcCommand (execute SQL cmd/stored proc) OdbcDataReader (fast forward-only cursor) OdbcDataAdapter (useful in disconnected apps)

8 8 Oracle Data Provider Optimized and targeted access to Oracle data sources Introduced in the.NET Framework v1.1 (in v1.0, you have to use the OLE DB data provider instead) Use the System.Data.OracleClient namespace, which includes the following classes: OracleConnection (connect to database) OracleCommand (execute SQL cmd/stored proc) OracleDataReader (fast forward-only cursor) OracleDataAdapter (useful in disconnected apps)

9 9 Type Mappings Each data provider defines its own data mappings Database data types  CLR data types Example Commonly-used type mappings for the SQL Server data provider: SQL Server data typesCLR data types intSystem.Int32 decimal, numeric, money, smallmoneySystem.Decimal floatSystem.Double bitSystem.Boolean char, varchar, nchar, nvarcharSystem.String, System.Char[] date, datetime, smalldatetimeSystem.DateTime timestamp, binary, varbinarySystem.Byte[]


Download ppt "Overview of ADO.NET Chapter 1 ADO.NET 4.0 Development."

Similar presentations


Ads by Google