22.05.2017 Views

BIS 311 DeVry Week 7 iLab

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

(e) In the Solution Explorer pane on the right side of the screen, right-click on Form1.vb, select Rename, and change<br />

the name to ProductLookup.vb. Press Enter after entering the new form name.<br />

(f) Change the Text property of the form to Lab 7 Your Name (where Your Name = your full name), as you have done<br />

in previous labs.<br />

(g) Drag the following controls from the ToolBox onto the form, arrange them in a logical fashion, and set their properties<br />

as indicated in the table below.<br />

Control Name Property Text Property<br />

Label Label1 Product ID:<br />

TextBox<br />

txtProductID<br />

Button btnFindProduct Find Product<br />

Label Label2 Product name:<br />

Label lblProductName ????????<br />

Label Label3 Product price:<br />

Label lblProductPrice ????????<br />

Label lblMessage Ready<br />

(h) Ensure that the controls are positioned and sized so that the form has a neat, professional appearance and none<br />

of the text is cut off. Your completed form should look like the following.<br />

Step 2: Create Database Connection and Dataset<br />

.equella.ecollege.com/file/ffda06da-93d2-4c2b-8bea-5ff3d0e58d3e/76/<strong>BIS</strong><strong>311</strong>_W7_<strong>iLab</strong>.html#top">Back to Top<br />

(a) Pull down the Project menu and select Add New Data Source.<br />

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

(c) On the next screen, select Dataset and click Next.<br />

Step 3: Create SQL Query Method<br />

.equella.ecollege.com/file/ffda06da-93d2-4c2b-8bea-5ff3d0e58d3e/76/<strong>BIS</strong><strong>311</strong>_W7_<strong>iLab</strong>.html#top">Back to Top<br />

(a) In the Solution Explorer pane on the right, double-click the InventoryDataSet.xsd file to open it in the dataset design<br />

window. Right-click on ProductsTableAdapter, select Add, then select Query.<br />

(b) The TableAdapter Query Configuration Wizard appears. On the Choose a Command Type screen, ensure that the<br />

Use SQL Statements option is selected, and click Next.<br />

(c) On the Choose a Query Type screen, ensure that the option "SELECT which returns rows" is selected, and click<br />

Next.<br />

(d) On the Specify an SQL SELECT statement screen, add the clause WHERE ProductID=? at the end of the displayed<br />

SQL statement. This enables your query to retrieve a Product record with a specific ProductID, rather than returning all<br />

the records. Click Next.<br />

(e) On the Choose Methods to Generate screen, ensure that the checkbox next to Fill a DataTable is checked, and<br />

uncheck the checkbox next to Return a DataTable. Change the Method name under Fill a DataTable to FillByProductID.<br />

Click Next.<br />

(f) The Wizard Results screen should confirm that the SELECT statement and Fill method were generated with no<br />

errors. Click Finish.<br />

(g) Pull down the File menu and select Save All. If a Save Project dialog appears, ensure that the project is saved to<br />

the My DocumentsVisual Studio 2012Projects folder under your DSI number. Click Save.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!