Lab 7 of 7: Two-Tier Applications (40 Points)Submit your assignment to the Dropbox located on the silver tab at the top of this page.(See Syllabus “Due Dates for Assignments & Exams” for due dates.)L A B O V E R V I E WScenario and SummaryIn this exercise, you will create a two-tier application that retrieves a password from an Access database called LoginData.mdb. This database contains a table called LoginData, which has the following structure and data.StructureDataThe user-services layer (a Windows form) will look like the following.When the user presses the Retrieve Password button, the button_click event fires. This event instantiates a DataServices class. DataServices receives the username from the user and either sends back the password or a “not found” message indicating that the username isn’t in the database.Result if UserName is foundResult if UserName is not FoundDeliverablesSectionDeliverablePointsStep 13Lab7YourFirstLastName.docx (Word document) Screen shot of Windows form Screen shot of DataService class code Screen shot of button_click event code40CategoryPoints%Verify project configuration.512.5%Make all the files visible.37.5%Move the Logindata.mdb file.512.5%Add a database to a project.820%Design and code a DataService class.820%Design Form1.vb and set the properties as instructed.512.5%Code the button-click event.37.5%Test the application.37.5%Total40100%L A B S T E P SPreparation1. Go to Doc Sharing and get the database called LoginData.mdb. Store it in the root directory of the computer that you’re working on. Use the root directory of your computer’s C: drive or the root directory of your USB drive. By the root directory, we mean the top-level folder on your machine, called C:\ for the C: drive (or something like that) or E:\ for the USB drive (the drive letter may vary for the USB drive). TIP: Don’t put the LoginData.mdb file on your desktop or in a folder somewhere; put it in the root directory of C: drive or your USB drive. This will make it easier to access from within Visual Studio later.2. Log onto the Citrix server and launch Visual Studio 2010.L A B S T E P SSTEP 1Start a new Visual Basic Windows Forms Application Project and name it Lab7YourFirstLastName. (If needed, please refer to Lab 4, Step 2 for detailed instructions.)L A B S T E P SSTEP 2We need to verify what the configuration of the project is so that the compiler will generate only 32-bit (and not 64-bit) code. This is a technical detail that is necessary because we will be working with a Microsoft Access database, and only 32-bit driver software is available for this database. To do this, go to Build > Configuration Manager.In the Configuration Manager’s “Active solution platform” dialog, it should say x86. If it does, then the configuration is fine. If not, then click on the drop-down list under the “Active solution platform” and select .
Under “Type or select the new platform,” change what is currently there to x86 and click OK.
Click Close to close the Configuration Manager.
L A B S T E P S
STEP 3
Go to the Solution Explorer and make all the files and folders in your project visible. Do this by clicking on the Show All Files icon. This icon has a blue border around it in the diagram below, and it has a group of files and folders superimposed on each other.
After pressing the button, your Solution Explorer should look similar to the following.
L A B S T E P S
STEP 4
Click on the plus sign to the left of the bin folder. The bin folder will expand to show the Debug folder. Click on its plus sign to show its files. You will place your Logindata.mdb database in this Debug folder. The database must be in this folder for your application to work properly. Your Solution Explorer should look similar to this.
If there happens to be more files, or even another folder, within the Debug folder than what is in the screenshot, it is fine.
L A B S T E P S
STEP 5
Put your mouse on the Debug folder and right click it. Select “Include in Project.” Then, right click on the same folder a second time and select “Add > Existing Item.” Browse to the location on your local computer where you downloaded the Logindata.mdb database earlier (the C$ on ‘Client’ if you used your C: drive or the drive letter of your USB drive followed by $ if you used your USB drive). Also, click on the drop-down arrow in the drop-down list beside the File name box and select “All Files” (*.). (If you don’t do this, you won’t be able to see your database.) You should see something like the following.
L A B S T E P S
STEP 6
Now, let’s put the database in the Debug folder. Select LoginData and then click the Add button. If the Data Source Configuration Wizard dialog appears, click Cancel.
Your Solution Explorer should now look similar to this, with a copy of the LoginData database in the bin\Debug folder.
L A B S T E P S
STEP 7
Now, you can design your data-services class. Go to Project > Add Class, and add a class named DataService (refer to your previous iLabs if you need a reminder of how to add a class). Your complete Solution Explorer should look like this.
L A B S T E P S
STEP 8
If it is not already open, open up the DataService class by double clicking on it. Place the following code in it, along with your name in a comment at the top.
Your biggest challenge will likely be typing in the connection string, which contains the provider, the path to the database, and the name of the database. This must be typed exactly as shown in the screen shot. If this level of detail causes difficulty, you can just cut and paste the following connection string into the class (after typing cn.ConnectionString = ).
“Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|\LoginData.mdb;”
L A B S T E P S
STEP 9
In the Solution Explorer, double click on the form Form1.vb so that you can design it. From the Toolbox, drag two Labels (a Textbox and a Button) onto the form, and arrange them as follows.
L A B S T E P S
STEP 10
Set the following properties for the controls on the form.
Control
Property
Setting
Form1.vb
Text
Lab7YourFirstLastName
Label1
Text
Enter User Name
Textbox1
Name
txtUserName
Button1
Text
Retrieve Password
Label2
Name
lblResult
lblResult (was Label2)
Text
Search Results Display Here
Make sure your completed form looks like this.
L A B S T E P S
STEP 11
Double click the Button to go to the button_click event, and type this code (make sure you put the name of the lab and your name in a comment at the top, as shown).
L A B S T E P S
STEP 12
Test the application by pressing the Start Debugging button. Try entering the username abc, and make sure the program returns the value 123. Try entering an invalid username, such as
FunkyMonkey, or leaving the username column blank. The program should display error messages in these cases.
L A B S T E P S
STEP 13
Create a Word document called Lab7YourFirstLastName.docx and paste a screen shot of your form, the DataService class code, and your button_click event code. Make sure that your name is in the text property of the form and in a comment at the top of each DataService class. Submit your Word document containing these three screen shots to the Week 7 Dropbox.
Congratulations! You’ve written a two-tier application.

Here is compete solution for BIS311 Lab 7

If you have more questions, please contact me via email support@extutorials.com

﻿'Lab7YourName
Imports System.Data.OleDb
Public Class DataService
Public SearchItem As String
Public Function GetData() As String
Dim cn As New OleDbConnection
Dim cm As New OleDbCommand
Dim da As New OleDbDataAdapter
Dim ds As New DataSet
Dim result As String
'Set Connection String
'Microsoft.ACE.OLEDB.12.0
cn

﻿'------------------------------------------------------------------------------
'
' This code was generated by a tool.
' Runtime Version:4.0.30319.18408
'
' Changes to this file may cause incorrect behavior and will be lost if
' the code is regenerated.
'
'------------------------------------------------------------------------------

﻿Imports System
Imports System.Reflection
Imports System.Runtime.InteropServices
' General Information about an assembly is controlled through the following
' set of attributes. Change these attribute values to modify the information
' associated with an assembly.
' Review the values of the assembly attributes

﻿'------------------------------------------------------------------------------
'
' This code was generated by a tool.
' Runtime Version:4.0.30319.18408
'
' Changes to this file may cause incorrect behavior and will be lost if
' the code is regenerated.
'
'------------------------------------------------------------------------------

﻿'------------------------------------------------------------------------------
'
' This code was generated by a tool.
' Runtime Version:4.0.30319.18408
'
' Changes to this file may cause incorrect behavior and will be lost if
' the code is regenerated.
'
'------------------------------------------------------------------------------