Objective In this lab, students will complete the following objectives.
Objective
In this lab, students will complete the following objectives.
• Create a connection to an Access database.
• Create various SQL queries to extract information from a database.
• Format extracted data with column headers.
Element K Network Connections
For this lab, we will only need to connect to vlab-PC1. The computer vlab-PC1 is the computer on the left side while vlab-PC2 is on the right. If you leave the cursor on the PC icon for a few seconds, a tool-tip message will appear indicating the hostname of the PC. Open vlab-PC1 and log in as Administrator with the password password.
Lab Overview
Even though we are only using vlab-PC1 to complete our lab assignment, the database we will be accessing (Computers.accdb) is actually located on the computer vlab-PC2 in the directory C:Database. This directory is shared as a ReadOnly network share by vlab-PC2. The Universal Naming Convention (UNC) name for this share is \vlab-PC2Database. Our VBScript program vlab-PC1 will have to open the \vlab-PC2Database share and map it to the local X: drive. The path specified fro the database will then be X:Computers.accdb.
The IT department maintains an Access database on vlab-PC2 that is used to inventory the computers in the various rooms. Fields in the database include: Computer Type, Hostname, Room Number, CPU Type, Number of Bits, Speed, Number of Processors, Operating System, Memory, and Hard Drive Size. We need to query this database to determine upgrades and replacements for existing computers.
Below (and on the following page) is a listing of the Computers.accdb database contents:
Task 1: Understanding the Net Use Commands in ComputerDatabase.vbs
• Open Notepad++. Use the menu option File/Open to open the VBScript program: C:ScriptsComputerDatabase.vbs.
Task 2: Understanding the ADODB.Connection and ADODB.Recordset Objects
• In NotePad++, look at the following code lines