Provide explanation example of how to connect a Visual Basic application to a Microsoft Access database

Begin by opening you IDE (in this case, Visual Studio). Toward the top of the IDE, find the “View” option and on the menu bar, choose the option for “Data Sources” under the “Other Windows” selection.

Provide explanation example of how to connect a Visual Basic application to a Microsoft Access database  1

Select your data source type from the options presented in the “Data Source Configuration Wizard”. If your project does not have a current data source, you will be prompted to add a new data source which will bring you to the “Data Source Configuration Wizard”. Provide explanation example of how to connect a Visual Basic application to a Microsoft Access database  2

In my example, I will select “Database” and then hit, “Next”. I’m going to choose my model which is “Dataset” and then hit, “Next”. Provide explanation example of how to connect a Visual Basic application to a Microsoft Access database  3

I need to choose an application for my database. I will select “New Connection” and then use “Microsoft Access Database File” as my data source. I will then hit, “Continue”.

Provide explanation example of how to connect a Visual Basic application to a Microsoft Access database  4

I need to choose a database file. I’m going to use the “Games” database file in the Chapter 13 folder for this demonstration. I will enter a password to log on to my database and then “Test” my connection prior to hitting the “Ok” button. NOTE: If you include a password, it is wise NOT to include the string in the connection. Manage this in code people. Provide explanation example of how to connect a Visual Basic application to a Microsoft Access database  5

You will be prompted to save the connection string configuration file. Do this now and give your name a string that you can identify with.Provide explanation example of how to connect a Visual Basic application to a Microsoft Access database  6

After you save your connection string, you will be prompted to choose objects in your dataset. When you’re finished with your selection, hit “Finish”.

Provide explanation example of how to connect a Visual Basic application to a Microsoft Access database  7

You can now use your objects by dragging them onto the form and begin coding your application.

Provide explanation example of how to connect a Visual Basic application to a Microsoft Access database  8