1 / 13

ADO.NET Classes

ADO.NET Classes. What is ADO.NET Identifying All ADO.NET Objects Using ADO.NET in Windows App. Introduction. Set of Classes to Hold/Retrieve Data Two sets of classes - Connect to Databases - In-Memory Datasets (holds data). Identify Classes of ADO.NET. Connection Command

dante
Télécharger la présentation

ADO.NET Classes

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. ADO.NET Classes What is ADO.NET Identifying All ADO.NET Objects Using ADO.NET in Windows App Prepared By Hafeez Mohammed

  2. Introduction • Set of Classes to Hold/Retrieve Data • Two sets of classes • - Connect to Databases • - In-Memory Datasets (holds data) Prepared By Hafeez Mohammed

  3. Identify Classes of ADO.NET • Connection • Command • DataAdapter (intermediate layers) • DataReader • DataSet • DataTable • -DataRow, DataColumn • DataView Prepared By Hafeez Mohammed

  4. DataSource not limited to DB • DataSource typically is a Database engine • Can be a spectrum of popular DB’s • MSSQL Server7.0/2000 • Oracle8/8i/9i • MSAccess97/2000 • Or even text files or Spreadsheets • Can be XML files as well Prepared By Hafeez Mohammed

  5. Connection Object • Connection is used to open connection with a database • Two default types of this class • - OleDb datasource • - Sql Server datasources Prepared By Hafeez Mohammed

  6. Command Object • Used to submit SQL statements to the backend datasource • Can pass regular sql statements like Select, Insert or delete • Or can pass the name of the stored procedures • Sometimes CommandBuilder Object is used to build the Command Object Prepared By Hafeez Mohammed

  7. DataAdapter Object • Used to populate a DataSet or a DataTable in memory • Does everything automatically like creating Connection Object and connecting to the DB, uses the SQL with Command Object to retreive the data and fills up a DataSet or DataTable Class • Disconnects from the DB Prepared By Hafeez Mohammed

  8. DataReader Object • If you quickly want to fill a ListBox, Combo or a Grid use a DataReader Object • It’s a forward/read only cursor • It cannot be used to build a DataSet or a DataTable Prepared By Hafeez Mohammed

  9. DataSets/DataViews • Also called in-memory classes • Holds the Original and modified data • Does not know how to communicate with the datasources • Has DataRows and DataColumns • Specific view of Data • Can set filters, sorting here Prepared By Hafeez Mohammed

  10. SQL Client and OLE DB • There are two different flavors of the Connection, Command, CommandBuilder, DataAdapter and DataReader classes. • One set of these classes, prefixed with “OleDb” and use the OLE DB providers to get at a data source. The other set are prefixed with “Sql” and use native providers to talk directly to SQL Server. These two sets of classes come from two separate namespaces. Prepared By Hafeez Mohammed

  11. Types of ADO.NET Classes • OLEDB or SQLClient • OleDB provides you data from any datasource where as SQLClient is made purely for SQL Server • OleDB uses all classes prefixed with OleDB • OleDB.OleDBConnection • OleDB.OleDBDataAdapter Prepared By Hafeez Mohammed

  12. Native Client • SQLClient uses SQLClient prefix • SQLClient.SQLConnection • SQLClient.SQLDataAdapter • Will get better performance • Other Native Client classes are coming soon for clients like Oracle, MSAccess etc…. Prepared By Hafeez Mohammed

  13. Test Your Data Access Knowledge • 1.Which namespace would you use to go after an Oracle database? • 2.Which namespace would you use to go directly at SQL Server? • 3.Which class retrieves data from the data source? • 4.Which class will build a new command object for you? • True or False: A DataSet can update data directly in an SQL Server database? Prepared By Hafeez Mohammed

More Related