BIS311 Lab 7 – source code with screenshot – Instant Delivery – Complete and A+ Guaranteed
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 W
Scenario and Summary
In 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.
Structure
Data
The 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 found
Result if UserName is not Found
Deliverables
Section
Deliverable
Points
Step 13
Lab7YourFirstLastName.docx (Word document) Screen shot of Windows form Screen shot of DataService class code Screen shot of button_click event code
40
Category
Points
%
Verify project configuration.
5
12.5%
Make all the files visible.
3
7.5%
Move the Logindata.mdb file.
5
12.5%
Add a database to a project.
8
20%
Design and code a DataService class.
8
20%
Design Form1.vb and set the properties as instructed.
5
12.5%
Code the button-click event.
3
7.5%
Test the application.
3
7.5%
Total
40
100%
L A B S T E P S
Preparation
1. 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 S
STEP 1
Start 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 S
STEP 2
We 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.
* You can also use 2CO option if you want to purchase through Credit Cards/Paypal but make sure you put the correct billing information otherwise you wont be able to receive any download link.
* Your paypal has to be pre-loaded in order to complete the purchase or otherwise please discuss it with us at [email protected].
* As soon as the payment is received, download link of the solution will automatically be sent to the address used in selected payment method.
* Please check your junk mails as the download link email might go there and please be patient for the download link email. Sometimes, due to server congestion, you may receive download link with a delay.
* All the contents are compressed in one zip folder.
* In case if you get stuck at any point during the payment process, please immediately contact us at [email protected] and we will fix it with you.
* We try our best to reach back to you on immediate basis. However, please wait for atleast 8 hours for a response from our side. Afterall, we are humans.
* Comments/Feedbacks are truely welcomed and there might be some incentives for you for the next lab/quiz/assignment.
* In case of any query, please donot hesitate to contact us at [email protected].
* MOST IMPORTANT Please use the tutorials as a guide and they need NOT to be used for any submission. Just take help from the material.
******************************************** Good Luck ***************************************************
Any personal information received will only be used to fill your order. We will not sell or redistribute your information to anyone.
We will try our best to resolve the issue and if still persists we can discuss for a refund in case its required.