In Chapter 1, you created a couple of forms and some Find buttons, but your forms were left more or less inert; they do not interact with real data.
In this chapter you’ll begin to extract data from the Northwind database that comes both with SQL Server and SQL Server Express. You’ll use that data to fill in your forms. You’ll do this incrementally, adding complexity as you go. You’ll put a premium on using data controls provided with Visual Basic 2005 and letting the controls manage the “plumbing” of database interaction for you.
If you do not have either SQL Server or SQLServer Express you will need to download a copy from Microsoft. There is usually some form of demonstration version available, though the names and conditions change from time to time. As of this writing, SQL Server Express is bundled with all versions of Visual Studio 2005 or is available as a free download on the Microsoft site (http://www.Microsoft.com).
Return to the first tab of
frmCustomerDetails and give each text box a reasonable name (e.g.
txtCity, and so on).
This chapter picks up on the code from the previous chapter. If you download the source, however, you’ll find that we’ve created folders with snapshots that represent the state of the code at the end of each chapter.
You need a connection to the database. Before you begin, open the Data Sources Window (Data → Show Data Sources). From this floating, dockable ...