14.2. Using Your Own Databases
There are many different types of commercially available databases. Microsoft offers Access and SQL Server, IBM offers DB2, MySQL (which is open source), Oracle, and probably dozens of others. You can use C# to communicate with any of them. In this section, however, we are going to use Access to illustrate how you use C# with commercial databases. There are several reasons for this choice. First (and foremost), you don't have to buy or install additional software to use the programs that follow in this chapter. Visual Studio comes with Access support built in. Second, Access is capable of serving almost any database application need, provided you don't have too many users accessing the database at the same time. Access is capable of performing serious work as long as you don't bog it down with more than four or five users at one time.
14.2.1. ADO.NET
Before you jump into the code that you will use to create your own databases, you need to understand how C# interacts with a database. The primary vehicle for this interaction is ADO.NET, which stands for the underlying technology for ActiveX Data Objects. While this technology has been around for some time, it has undergone a substantial evolution over the years. In its current form, ADO.NET provides an efficient means for interacting with any database.
You can think in terms of ADO.NET as consisting of two primary elements: 1) a data provider element and 2) a datasets element.
14.2.1.1. Data Provider ...
Get Beginning C# 3.0 now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.