Hour 21. Working with a Database


What You'll Learn in This Hour:

  • Introduction to ADO.NET

  • Connecting to a database

  • Understanding DataTables

  • Creating a DataAdapter

  • Referencing fields in a DataRow

  • Navigating records

  • Adding, editing, and deleting records

  • Building an ADO.NET example

You've heard it so many times that it's almost a cliché: This is the Information Age. Information is data, and managing information means working with databases. Database design is a skill unto itself, and entire books are devoted to database design and management. In this hour, you'll learn the basics of working with a database using ADO.NET, Microsoft's newest database technology. Although high-end solutions are built around advanced database technologies such as Microsoft's SQL Server, the Microsoft Jet database used by Microsoft Access is more readily available and easier to learn, so you'll build working examples that use a Jet database. Be aware, however, that 99% of what you learn here is directly applicable to working with SQL Server as well.

By the Way

You'll learn a lot in this hour, but realize that this material is really the tip of the iceberg. Database programming can be, and often is, complex. This hour is intended to get you writing database code as quickly as possible, but if you plan to do a lot of database programming, you'll want to consult a dedicated book (or two) on the subject.


Begin by creating a new Windows Application named Database Example. Next right-click Form1.cs in the Solution Explorer window, choose Rename, and then change the name of the default form to frmMain.cs. Next, set the form's Text property to Database Example.

Now that the project has been created, follow the steps in the following sections to build your database project.




Sams Teach Yourself Microsoft Visual C# 2005 in 24 Hours, Complete Starter Kit
Sams Teach Yourself Visual C# 2005 in 24 Hours, Complete Starter Kit
ISBN: 0672327406
EAN: 2147483647
Year: N/A
Pages: 248
Authors: James Foxall

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net