Chapter 2. Accessing Data

In This Chapter

  • Understanding the System.Data namespace

  • Connecting to a data source

  • Working with data from databases

Not to predispose you to the contents of this chapter, but you will probably find that data access is the most important part of your use of the .NET Framework. You likely will use the various features of the System.Data namespace more than any other namespace.

Unquestionably, one of the most common uses of Visual Studio is the creation of business applications. Business applications are about data. This is the black and white of development with Visual Studio. While understanding a little of everything is important, complete understanding of the System.Data namespace is essential when you're building business applications.

Until the .NET Framework became popular in the 2003 timeframe, most business applications built using Microsoft products used FoxPro or Visual Basic. C# has unquestionably replaced those languages as the business programmer's language of choice over the past several years.

You can look at the data tools in C# in three ways:

  • Database connectivity: Getting information out of and into a database is a primary part of the System.Data namespace.

  • Holding data in containers within your programs: The DataSet, DataView, and DataTable containers are useful mechanisms for accomplishing the holding of data. If you are a Visual Basic 6 or ASP programmer, you remember Recordsets, which have been replaced by the new constructs.

Note

The Language ...

Get C# 2010 All-in-One For Dummies® 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.