Microsoft Visual Basic 2010 Step by Step eBook

(Tina Meador) #1

444 Part IV Database and Web Programming


Although in this chapter we will be experimenting with this process in a Windows Forms
application, in Visual Basic 2010, you can also bind dataset information to Windows
Presentation Foundation (WPF) client applications and Web applications (ASP .NET or
Silverlight). You’ll learn about databases and ASP .NET in Chapter 20, “Creating Web Sites
and Web Pages by Using Visual Web Developer and ASP .NET .”

Working with an Access Database


In the following sections, you’ll learn how to use the ADO .NET data access technology
in Visual Basic 2010. You’ll get started by using the Data Source Configuration Wizard to
establish a connection to a database named Faculty2010 .accdb that I created in Access 2007
format. (It will also work in Access 2010, the newest version of Access .) Faculty2010 .accdb
contains various tables of academic information that would be useful for an administrator or
teacher who is organizing faculty schedules or workloads, or important contact information
for the employees at a college or school. You’ll learn how to create a dataset based on a table
of information in the Faculty2010 database, and you’ll display this information on a Windows
form. When you’ve finished, you’ll be able to put these skills to work in your own database
projects.

Tip Although the sample in this chapter uses an Access database, you don’t have to have Access
installed. However, a few Microsoft connectivity components may be required on your computer
to work with Access files, depending on how your system has been configured. If you try to
complete the exercises below and receive an error message indicating that Microsoft .Jet .OLEDB
is not registered on your computer or the Access database format is not recognized, you should
complete Step 1 below to install the necessary connectivity components before you work with
ADO .NET. Also, note that Faculty2010 .accdb is in Access 2007 format. If you want to open the
file in Access and work with it, you’ll need to have Access 2007 or Access 2010 installed on your
system.

Establish a connection by using the Data Source Configuration Wizard


  1. Make sure that you have Access 2007 or later installed. If you don’t have Access 2007
    installed, download and install the 2007 System Driver: Data Connectivity Components
    from Microsoft .com.

  2. Start Visual Studio, and then create a new Visual Basic Windows Forms Application
    project named My ADO Faculty Form.
    A new project opens in the Integrated Development Environment (IDE).

Free download pdf