Home
Username:
Password:
Microsoft Visual Basic 2005 Tutorials

Database Files / Database Application Example




Visitors to VTC.com will be able to view all introductory videos for each training course.
Free Trial Members will gain access to first three chapters for each training course.
Full Access Members have full access to VTC.com’s entire library of video tutorials.


Learn More

Subtitles of the Movie

In this movie I will demonstrate creating a database application. That is, a Visual Basic program that will be linked to an Access data file. The good news here is that Visual Basic .NET's environment has provided a series of wizards that will step you through the process. But to get started, you first need to go to the Toolbox and expand the Data Control Group and select the Data Grid View Control. Double clicking will place that item on the form. A pop-up box called the Data Grid View Task Box will appear and by clicking on the Choose Data Source drop-down box, you will then want to add the project data source. Of course, if there was one previously existing, you would simply select that from the list. But in this case, I will add a new data file. You now will be asked to choose the proper data source. As you can see, you can choose from a database, a web service or an object. In our case, I will choose from a database, then choose Next. The next step is to establish a new connection. If you've already established a connection previously, that will be in the drop-down box. But to establish a new connection, you simply click the New Connection Button, which will then provide the next screen. If necessary, you may need to click the Change Button to change the data source. Once again, you can see the variety of data sources that Visual Studio will support. In this example I'm using the Microsoft Access database file so I'll simply click OK. Next step is to actually browse to the actual database file that will be used in our application. In this case, I'm browsing to it on my hard drive and selecting the file and then click Open. The next step is to test the connection. You'll notice in the bottom-left corner there is a Test Connection Button. If you simply click on that and then you should immediately receive a message that the test connection succeeded. If the test connection is not successful, you should stop immediately and retrace your steps as the connection has not been properly established and there's no point in going any further. Assuming this has been successful, you click OK and then click the OK Button once again. Back to the data source configuration wizard. You click the Next Button and this will tell you that the data file that you're selecting is not currently in the project. Would I like to copy the file into my project? And yes, I would. So I click Yes and it gives me the option of saving this connection or not, which I will choose to save at this point, again clicking Next. After a moment you will be provided with one last wizard which will ask you to choose your specific database objects. As you can see, the choices are between tables and views. You could choose the various tables and views that are in your database. In this example, I'm going to choose the client table and then click Finish. After a few moments, the database should now appear in your form and you can now work with the data just as if it were any other object. By click on the form and resizing the data grid view, you can expose the entire database if necessary and at run time you will now see that the data has been bound to the actual form in the database file itself. Now at run time, you can see that the data is indeed present and here is the data that's part of my database application. Of course, at this point you could manipulate the data and you could select the data just like you could if it were basically an Access spreadsheet. The key here is now we have a user-friendly application that the user simply can run from the Visual Studio environment to link to the Access data file. One last point of interest; if you notice at the bottom of the screen that in addition to the data set, the Visual Studio environment automatically added the necessary controls of the client binding source and the table adapter. These items are discussed in more detail in other movies. So don't be afraid to experiment with creating a database application in Visual Studio. The process is very simply and it can be completed in a very few steps.

Tutorial Information

Course: Microsoft Visual Basic 2005
Author: Arthur Lee
SKU: 33940
ISBN: 1-935320-10-6
Release Date: 2008-11-19
Duration: 7.5 hrs / 97 lessons
Work Files: Yes
Captions: Available on CD and Online University
Compatibility: Vista/XP/2000, OS X, Linux
QuickTime 7, Flash 8

VTC Sign up & Benefits

  • Unlimited Access
  • 98,729 Video Tutorials (23,265 free)
  • Video Available as Flash or QuickTime
  • Over 1026 Courses
  • $30 for One Month Access
  • Multi-User Discounts Available