22.05.2017 Views

CIS 407 DeVry iLab 3 of 7 latest

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

STEP 1: Data Connection, Dataset and Data Access Class (10 points)<br />

1. Open Micros<strong>of</strong>t Visual Studio.NET 2008.<br />

2. Open the PayrollSystem website by clicking on it in the Recent Projects list, or by pulling down the File menu,<br />

selecting Open Website, navigating to the folder where you previously saved the PayrollSystem, and clicking Open.<br />

3. Download the PayrollSystem_DB.MDB file from Doc Sharing and save it on your local computer. (Note: your<br />

operating system may lock or block the file. Once you have copied it locally, right click on the file and select Properties<br />

and then Unblock if available). Then add it to the PayrollSystem website as follows: In Visual Studio, in the Solution<br />

Explorer click Website, Add Existing Item, then navigate to the PayrollSystem_DB.MDB file you downloaded and click<br />

the Add button.<br />

4. Now we need to create a new connection to the PayrollSystem_DB.MDB. To begin, click View Server Explorer.<br />

5. When the Server Explorer toolbox appears, click the Connect to Database button.<br />

6. When the Add Connection dialog appears, click the Change button. In the “Change Data Source” dialog, select<br />

MS Access Database File; Uncheck Always use this Selection; then click OK.<br />

Click here for text description <strong>of</strong> this image.<br />

7. Click the Browse button to navigate to the PayrollSystem_DB.mdb file in your website folder, then click “Open”.<br />

(NOTE: Be sure you select the PayrollSystem_DB.mdb file in your PayrollSystem website folder, not the one you<br />

originally downloaded from Doc Sharing!) Click Test Connection. You should receive a message that the test<br />

connection succeeded. Click OK to acknowledge the message, then click “OK” again to close the Add Connection<br />

dialog.<br />

8. The PayrollSystem_DB.mdb should be added to the Server Explorer. Expand the database, then expand the<br />

Tables entry under the database until you see tblUserActivity. Leave the Server Explorer window open for now as you<br />

will be returning to it in a moment.<br />

Click here for text description <strong>of</strong> this image.<br />

9. Create a new dataset by selecting Website Add New Item. Under Templates, select the Dataset item. Enter<br />

dsUserActivity.xsd for the name. Click Add.<br />

Click on image to enlarge.<br />

Add Data Set<br />

10. Click here for text discription <strong>of</strong> this image.<br />

11.<br />

12. If the following message appears, select Yes. You want to make this dataset available to your entire website.<br />

13. If the TableAdapter Configuration Wizard dialog appears, click Cancel. (We will be configuring a Data Adapter for<br />

this dataset later in C# code, so we do not need to run this wizard.)<br />

14. Drag-and-drop the tblUserActivity table from the Server Explorer window into the dsUserActivity dataset in the<br />

editor window.<br />

NOTE: If you see a message that says your connection uses a local data file that is not in the current project, that<br />

indicates you did not select the correct PayrollSystem_DB.mdb file when you created your data connection. To fix this<br />

problem, click No, then right-click on PayrollSystem_DB.mdb in the Server Explorer window and choose Modify<br />

Connection. Click the Browse button, navigate to the PayrollSystem_DB.mdb file that is in your PayrollSystem website<br />

folder, and click Open. Test the connection, then click OK.<br />

15. Click the Save icon on the toolbar to save the dsUserActivity.xsd dataset.<br />

Click on image to enlarge.<br />

Dataset Saved<br />

16. Click here for text discription <strong>of</strong> this image.<br />

17. (You can now close the Server Explorer window if you wish.)

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

Saved successfully!

Ooh no, something went wrong!