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.
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”.
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”.
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”.
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.
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.
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”.
You can now use your objects by dragging them onto the form and begin coding your application.