BIS 311 DeVry Week 7 I Lab

Downloading is very simple, you can download this Course here:


Contact us at:


Question Description

BIS 311 DeVry Week 7 iLab


BIS 311 DeVry Week 7 iLab



In this lab, you will create a two-tier application that retrieves the name and price of a product from a Microsoft Access database.

Product Lookup Business Requirements

The user enters the product ID for a product. The application searches the Products table of a Microsoft Access database named Inventory.accdb for the specified product. If a matching product is found, its name and price are displayed. If the product is not found, the message “Product ID not found” is displayed.

TOE Chart for Product Lookup User Interface

Task Object Event
Get the following inputs from the user:
Product ID txtProductID
Perform the following processing:
Retrieve product data from database using product ID btnFindProduct dataSvc Click
Display the following output to the user:
If the product ID was found: Product name and price lblProductName, lblProductPrice
If the product ID was not found: “Product ID not found” lblMessage


Pseudocode for Product Lookup User Interface

Start button-click event handler

Instantiate dataSvc object from DataService class

Declare Boolean variable ProductFound

Get ProductID property of dataSvc from user

ProductFound= result of GetProduct() method of dataSvc

if ProductFound is True

Display Product name and Product price

Else Display “Product ID not found”

Stop button-click event handler

Class Diagram for DataService Class


+numeric ProductID

+string ProductName

+string ProductPrice


Pseudocode for GetProduct() Method of DataService Class

Boolean GetProduct()

Instantiate DataSet object for the Inventory database

Instantiate TableAdapter object for the Products table in the Inventory database

Declare Boolean variable Found

Use the Products TableAdapter object to retrieve the Products record matching ProductID into the Inventory DataSet object

If the count of Products records in the Inventory DataSet > 0

Set ProductName=ProductName field of the first retrieved record

Set ProductPrice=ProductPrice field of the first retrieved record

Set Found=True


Set Found = False

Return Found

End GetProduct()

Remember This

In a true client-server application running on a network, the code in the DataService class would be executed on the server (the data-services tier), and the form would be executed on the client (the user-interface tier). In this lab, both the DataService class and the form will be executed on the same computer.


Submit a Word document named Lab7YourFirstLastName.docx (where YourFirstLastName = your first and last name; e.g., Lab7JohnSmith.docx) containing the following.

  • Screenshot of form showing the application running, with a valid product ID entered and the corresponding product name and price displayed
  • Screenshot of form showing the application running, with an invalid product ID entered and the message “Product ID not found” displayed
  • Copy of code for button-click event
  • Copy of code for DataService class


Category Points % Description
Create and rename form, add controls, and set properties 15 30% Windows form was created and named ProductLookup.vb. Form text property was set to Lab 7 Your Name (where Your Name = your full name). The following controls were added to the form: Identifying label and text box for entry of product ID; button to perform product lookup; and labels for display of product name, product price, and error message. Name and text properties of all controls were set appropriately, with no typos or spelling errors.
Create database connection, dataset, and query function 10 20% A connection to the Inventory database and an associated dataset containing the Products table were created. A FillByProductID() method using an SQL query to retrieve a product record with a specified product ID has been added to the Products table adapter.
Code data service class 5 10% A DataService class was created with code that corresponds to the given class diagram and pseudocode, with no errors. Class includes public properties for the product ID, product name, and product price, and a GetProduct() method that retrieves the product name and price for a specified product ID and returns a Boolean value indicating success or failure. Code button-click event 5 10% Button-click event code was entered that corresponds to the given pseudocode, with no syntax errors. An object of the DataService class is instantiated and used to retrieve the product name and price for the product ID entered by the user. The name and price are displayed if the product record was found, or the “Product ID not found” message otherwise.
Test-run application successfully 15 30% Application is shown running successfully with screenshots for each of the 4 cases: cases 1–3 each show a valid product ID entered with correct name and price displayed; case 4 shows an invalid product ID entered with “Product ID not found” message displayed.
Total 50 100%


Required Software

Visual Studio 2012

Access the software”>

Steps: all

iLAB STEPS Step 1: Create Project and Form”>Back to Top

(a) Important: Before beginning this lab, download the Microsoft Access database file Inventory.accdb from Doc Sharing and save it to your Downloads folder or on your computer desktop. Don’t open the file from Doc Sharing, just save it and make a note of where it is located. If it downloads automatically when you click on it in Doc Sharing, it is most likely saved in your Downloads folder, but check to make sure. You will need to be able to locate this file to create a data connection to it in Step 2.

(b) Log in to the Citrix iLab site as you did in the previous labs. Click the Microsoft Visual Studio 2012 icon to launch Visual Studio.

(c) Pull down the File menu and select New Project . . .

(d) In the New Project dialog, ensure that under Templates in the left column, Visual Basic is selected, and that in the center column, Windows Form Application is selected. In the Name field at the bottom of the dialog, enter ProductLookup. Click OK.

(e) In the Solution Explorer pane on the right side of the screen, right-click on Form1.vb, select Rename, and change the name to ProductLookup.vb. Press Enter after entering the new form name.

(f) Change the Text property of the form to Lab 7 Your Name (where Your Name = your full name), as you have done in previous labs.

(g) Drag the following controls from the ToolBox onto the form, arrange them in a logical fashion, and set their properties as indicated in the table below.

Control Name Property Text Property
Label Label1 Product ID:
TextBox txtProductID
Button btnFindProduct Find Product
Label Label2 Product name:
Label lblProductName ????????
Label Label3 Product price:
Label lblProductPrice ????????
Label lblMessage Ready


(h) Ensure that the controls are positioned and sized so that the form has a neat, professional appearance and none of the text is cut off. Your completed form should look like the following.

Step 2: Create Database Connection and Dataset”>Back to Top

(a) Pull down the Project menu and select Add New Data Source.

(b) The Data Source Configuration Wizard should appear. On the first screen, select Database and click Next.

(c) On the next screen, select Dataset and click Next.

Step 3: Create SQL Query Method”>Back to Top

(a) In the Solution Explorer pane on the right, double-click the InventoryDataSet.xsd file to open it in the dataset design window. Right-click on ProductsTableAdapter, select Add, then select Query.

(b) The TableAdapter Query Configuration Wizard appears. On the Choose a Command Type screen, ensure that the Use SQL Statements option is selected, and click Next.

(c) On the Choose a Query Type screen, ensure that the option “SELECT which returns rows” is selected, and click Next.

(d) On the Specify an SQL SELECT statement screen, add the clause WHERE ProductID=? at the end of the displayed SQL statement. This enables your query to retrieve a Product record with a specific ProductID, rather than returning all the records. Click Next.

(e) On the Choose Methods to Generate screen, ensure that the checkbox next to Fill a DataTable is checked, and uncheck the checkbox next to Return a DataTable. Change the Method name under Fill a DataTable to FillByProductID. Click Next.

(f) The Wizard Results screen should confirm that the SELECT statement and Fill method were generated with no errors. Click Finish.

(g) Pull down the File menu and select Save All. If a Save Project dialog appears, ensure that the project is saved to the My DocumentsVisual Studio 2012Projects folder under your DSI number. Click Save.

(h) Click the X on the right of the InventoryDataSet.xsd tab to close the dataset design window.

Step 4: Create DataService Class”>Back to Top

(a) Pull down the Project menu, select Add Class, and add a new class file named DataService.vb to your project.

(b) Starting where the cursor is positioned, in between the Public Class Order and the End Class statements, enter the following code.

Code for DataService Class

‘Data access services class

Public Property ProductID As Integer

Public Property ProductName As String

Public Property ProductPrice As Decimal

Public Function GetProduct() As Boolean

‘Get product data from database for product matching ProductID

Dim productsTA As New InventoryDataSetTableAdapters.ProductsTableAdapter

Dim inventoryDS As New InventoryDataSet

Dim blnFound As Boolean


If inventoryDS.Products.Count > 0 Then

ProductName = inventoryDS.Products(0).ProductName

ProductPrice = inventoryDS.Products(0).ProductPrice

blnFound = True


ProductName = “”

ProductPrice = 0

blnFound = False

End If

Return blnFound

End Function

(c) After entering the above code, your code editor window should look like this.

Step 6: Test, Debug, and Submit”>Back to Top

(a) Run the application by doing one of the following: click the Start button; pull down the Debug menu and select Start Debugging; or press the F5 key.

(b) Your form should appear. Test your application by entering the following test cases. For each test case, enter the indicated value for Product ID; click the Find Product button; and check that the result displayed is correct. Capture a screenshot of each correct test case and paste it into a Word document. Remember, use CTRL+ALT+PrintScreen to capture a screenshot.

Test case # Product ID Product name Product price Message
1 123 Road bike $499.95 Product ID found
2 456 Mountain bike $359.95 Product ID found
3 789 Town bike $579.95 Product ID found
4 999 Product ID not found


As an example, your screenshot for test case #1 should look like the following.

(c) If your application does not work correctly, debug the application and try again. Post in the Q & A Forum or contact your professor for assistance, if needed.

(d) When your application works correctly for all test cases, select and copy all the code for the button-click event handler and the DataService class and paste it into your Word document below the test case screenshots. Save the Word document as Lab7YourFirstLastName.docx (where YourFirstLastName = your first and last name; e.g., JohnSmith) and submit it to the appropriate dropbox.