Vbscript Database Query Lab Report

627 Words3 Pages
Student Name: Date: VBScript Database Query Lab Report Task 4: Write and Run Database Query Program 1 In this scenario, we need to query the Computer database to determine which computers need to be replaced. Our decision will be based on the CPU speed, Number of Processors and the size of the Hard Drive. In the space provided in your Lab Report document, paste your modified VBScript program and the RUN. In the table cell below, paste your ComputerReplace.vbs Program '==========================================================================' NAME: ComputerDatabase.vbs'' AUTHOR: ' DATE : 8/24/14'' COMMENT: Use 32 bit ODBC Microsoft Access Driver''==========================================================================recordsStr = ""sqlStr = "SELECT Computer,Room_Num,Speed,Num_CPUs,OS_Type,HDD_Size FROM ComputersWhere Num_CPUs = 1 OR Speed<2.1 OR HDD_Size <300 order by Room_num"dataSource = "provider=Microsoft.ACE.OLEDB.12.0;" _& "data source=C:\Scripts\Computers.accdb"Set objConnection = CreateObject("ADODB.Connection")objConnection.Open dataSourceSet objRecordSet = CreateObject("ADODB.Recordset")objRecordSet.Open sqlStr , objConnectionobjRecordSet.MoveFirst' Display HeadersrecordsStr = "Computer HostName Room_Num" & _ " CPU_Type Speed Num_CPUs Bit_Size OS_Type " & _ " Memory HDD_Size" & vbCrLf & _ "============================================================" & _ "=============================" & vbCrLfDo Until objRecordSet.EOF recordsStr = recordsStr & objRecordSet.Fields.Item("Computer") & _ vbTab & pad(objRecordSet.Fields.Item("Room_Num"),13) & _ vbTab & objRecordSet.Fields.Item("Speed") & _ vbTab & pad(objRecordSet.Fields.Item("Num_CPUs") ,14) & _ vbTab &

More about Vbscript Database Query Lab Report

Open Document