100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached
logo-home
COMP 230 Week 7 Lab Report: VBScript Database Query Lab Report (GRADED A) $10.99   Add to cart

Exam (elaborations)

COMP 230 Week 7 Lab Report: VBScript Database Query Lab Report (GRADED A)

 2 views  0 purchase
  • Course
  • Institution

COMP 230 Week 7 Lab Report: VBScript Database Query Lab Report (GRADED A)

Preview 1 out of 4  pages

  • May 5, 2022
  • 4
  • 2021/2022
  • Exam (elaborations)
  • Unknown
avatar-seller
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.
'==========================================================================
'Program = ComputersReplace.vbs
'Author =
'Comp230
'
'==========================================================================

'setting up the data source location
recordsStr = ""
sqlStr = "SELECT Computer,Room_Num,Speed,Num_CPUs,OS_Type,HDD_Size FROM Computers Where
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:\comp230\Computers.accdb"


'creating objects to establish the connection
Set objConnection = CreateObject("ADODB.Connection")
objConnection.Open dataSource
Set objRecordSet = CreateObject("ADODB.Recordset")
objRecordSet.Open sqlStr , objConnection
objRecordSet.MoveFirst

' Display Headers
recordsStr = "Computer Room_Num" & _
" Speed Num_CPUs OS_Type " & _
" HDD_Size" & vbCrLf & _
"============================================================" & _
"=============================" & vbCrLf

'displaying the hardware info and location of the device
Do 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 & pad(objRecordSet.Fields.Item("OS_Type"),22) & _
vbTab & objRecordSet.Fields.Item("HDD_Size") & vbCrLf
objRecordSet.MoveNext
Loop
objRecordSet.Close
objConnection.Close

WScript.Echo recordsStr

function pad(ByVal strText, ByVal len)
pad = Left(strText & Space(len), len)
end Function



COMP230_Wk7_Database_Report.docx 1
This study source was downloaded by 100000845689434 from CourseHero.com on 05-05-2022 12:27:27 GMT -05:00
Revision Date: 1213


https://www.coursehero.com/file/13543688/Week-7-Lab-Report/

The benefits of buying summaries with Stuvia:

Guaranteed quality through customer reviews

Guaranteed quality through customer reviews

Stuvia customers have reviewed more than 700,000 summaries. This how you know that you are buying the best documents.

Quick and easy check-out

Quick and easy check-out

You can quickly pay through credit card or Stuvia-credit for the summaries. There is no membership needed.

Focus on what matters

Focus on what matters

Your fellow students write the study notes themselves, which is why the documents are always reliable and up-to-date. This ensures you quickly get to the core!

Frequently asked questions

What do I get when I buy this document?

You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.

Satisfaction guarantee: how does it work?

Our satisfaction guarantee ensures that you always find a study document that suits you well. You fill out a form, and our customer service team takes care of the rest.

Who am I buying these notes from?

Stuvia is a marketplace, so you are not buying this document from us, but from seller ProfGoodlucK. Stuvia facilitates payment to the seller.

Will I be stuck with a subscription?

No, you only buy these notes for $10.99. You're not tied to anything after your purchase.

Can Stuvia be trusted?

4.6 stars on Google & Trustpilot (+1000 reviews)

81989 documents were sold in the last 30 days

Founded in 2010, the go-to place to buy study notes for 14 years now

Start selling
$10.99
  • (0)
  Add to cart