1 / 9

Overview of ADO.NET

Overview of ADO.NET. Chapter 1 ADO.NET 4.0 Development. 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. What is ADO.NET?. Microsoft's database API for the Internet era

toviel
Download Presentation

Overview of ADO.NET

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


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

  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 2

  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 3

  4. DataSet XxxDataReader XxxDataAdapter 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 Connection XxxConnection ADO ADO.NET Command XxxCommand RecordSet 4

  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) 5

  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) 6

  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) 7

  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) 8

  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 types CLR data types int System.Int32 decimal, numeric, money, smallmoney System.Decimal float System.Double bit System.Boolean char, varchar, nchar, nvarchar System.String, System.Char[] date, datetime, smalldatetime System.DateTime timestamp, binary, varbinary System.Byte[] 9

More Related