1 / 20

Introduction to ADO.NET

Introduction to ADO.NET. High Level Overview. Topics. What is ADO.NET? Three-tier model Data Providers SQL Relational Database. What is ADO.NET?. Microsoft A ctiveX D ata O bject (old) ADO.NET object provides an API for accessing database systems programmatically

sheryl
Download Presentation

Introduction to 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. Introduction to ADO.NET High Level Overview

  2. Topics • What is ADO.NET? • Three-tier model • Data Providers • SQL • Relational Database

  3. What is ADO.NET? • Microsoft ActiveX Data Object (old) • ADO.NET object provides an API for accessing database systems programmatically • Interface/Interaction • Relational database • XML • Excel Spreadsheet • Text file • Object-orientated set of libraries • Used in • Windows • Console • Web (asp)

  4. Three Tier Architecture Client Or User Interface Windows, Console, Web C# Front-end C# Middle-layer Business Layer Classes, Components ADO.NET Database Management System Data Store

  5. A Web Example

  6. Two Tier Architecture Client And Business Rules Windows, Console, Web C# Front-end Classes, Components ADO.NET Database Management System Data Store

  7. Data Providers • Data sources (e.g. databases) • Expose different protocols • Choose the right protocol for the right database • Older data sources use ODBC • Newer data sources use OleDb • ODBC and OleDb are APIs

  8. Data Providers

  9. Namespaces Available • System.Data • Root namespace • System.Data.OleDB • Works with any data source • System.Data.SqlClient • Designed to work with Microsoft SQL Server

  10. Some ADO.NET Objects • SqlConnection Object • SqlCommand Object • SqlDataReader Object • DataSet Object • SqlDataAdapter Object

  11. SQL • Structured Query Language • ADO.NET interacts with relational database with the help of SQL • Need to know SQL in order to interact with a Database Management System (DBMS)

  12. Relational Database • Uses tables • Each row is a record • Each record has a key field • A key field should be unique • Tables are “connected” via foreign keys (a key from another table)

  13. Simple ERD • Entity Relationship Diagram • Entity more-or-less equates to a table • Each primary key can become a foreign key in another table

  14. Sample Table: Student

  15. Sample Table: Subject

  16. Sample Table: Registration

  17. Relational Databases • Use SQL to write data into tables • INSERT statement • Use SQL to retrieve data from tables • SELECT statement • Use SQL to delete data from tables • DELETE statement • Use SQL to edit data in tables • UPDATE statement • See page 905 in Deitel & Deitel

  18. Asking Specific Questions SELECT <fields> FROM <tables> WHERE <conditions> INNER JOIN <tables> GROUP BY <fields> ORDER BY <fields> • Structure of a query • Fields and tables are separated by commas (,) • Conditions use the usual operators (=, >, <, and, or)

  19. SQL Examples • MS Access Chocolate Factory • MS Access • Own version of SQL (called Jet) • Queries similar to Oracle • Only good for SMALL applications • Not very robust • Not extensible (doesn’t support a large number of users) • Doesn’t delete data • Doesn’t handle concurrency issues very well • Gets big very quickly (bloats)

  20. Sources • C# Station • http://www.csharp-station.com/Tutorials/AdoDotNet/Lesson01.aspx • Deitel & Deitel (Chapter 19) • Deitel & Deitel - C# 2005- (Chapter 20) • Gittleman (Chapter 15) • http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cossdk/html/a03327c1-e427-4c07-b3d4-808ce81c2c96.asp • http://msdn.microsoft.com/library/default.asp?url=/library/en-us/xmlsql/ac_xml1_64md.asp

More Related