Accessing Databases

In most cases, you will use ADO.NET to access information from databases. The Data Provider and DataSet together provide functionality that makes data access a simple task.

The Basic Operations

The basic operations you can perform with ADO.NET are to retrieve information from tables, display that information, and sort the rows.

Windows Forms generate the output for all of the code examples in this section. Listing 19.4 shows the use of ADO.NET to populate the list in a combo box. To add a list to the combo or list box, you can use either a DataSet or a DataReader. Because the task involves only the reading of records, a DataReader object implements the task.

To execute Listing 19.4, you need to create a form with a combo ...

Get Special Edition Using C# 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.