IN BRIEF This chapter will show you how to use the various data providers that ship with the .NET Framework, as well as mention some alternative data providers that are available. A data provider is a collection of classes that provides programmatic access to some source of data. That data source could be a flat file on a disk, an MS Access database, an Excel spreadsheet, an Oracle server, SQL Server, or virtually any other data source on the market. You will see how the SQL and OLEDB data providers work, as well as how to attach a DataSet to a data provider for automatic propagation of changes to the DataSet to the data source. By the end of this chapter, you will have a firm grasp on the concept of a data provider, how to use data providers, and how to use a data provider in combination with a DataSet for dynamic binding and updating. WHAT YOU NEED REQUIRED SOFTWARE | .NET Framework SDK v1.1 Visual Studio .NET 2003 with C# installed SQL 2000 Sample DB and/or MS Access sample DB | RECOMMENDED HARDWARE SKILLS REQUIRED | PC that meets .NET SDK minimum requirements C# and .NET familiarity |
USING .NET DATA PROVIDERS AT A GLANCE SQL Server Data Provider | 537 | | | | Introduction to the SQL Server Data Provider | 537 | The SqlCommand Class | 540 | | Using the SqlConnection Class | 537 | The SqlDataReader Class | 542 | | Using Database Connection Strings with a SqlConnection | 539 | The SqlDataAdapter Class | 542 | Working with the OLEDB Data Provider | 544 | | | | Overview of the OLEDB Data Provider | 545 | Using the OleDbDataReader | 546 | | Using the OleDbConnection | 545 | Using the OleDbDataAdapter | 546 | | Using the OleDbCommand | 545 | | | Additional Data Providers | 547 | | | | The Oracle .NET Data Provider (ODP.NET) | 547 | The .NET ODBC Data Provider | 548 | | | The mySQL .NET Data Provider | 548 | | The Microsoft .NET Data Provider for Oracle | 547 | | | DataSet and DataAdapter Binding | 548 | | | | DataSet Review Review | 548 | Sample: Hooking Up a DataSet to a Live Data Source | 549 | | Associating a DataSet with a DataAdapter | 549 | | | Summary | 552 | | | Further Reading | 552 | | |
|