The Story so far System split into layers – maintainability & re-use Database – queries, tables, rows, columns & parameters Range of objects allowing us to control different parts of the computer using their methods & properties Variables – RAM Controls – Interface DataConnection class – database Introduced a lot of coding concepts, assignment, sequence, selection, validation, functions, parameters to name a few
Overview of Driving Test 2
How do we Manipulate a List of Data?
Array Lists Our list of data… Fred Wilma Barney Betty The code… Dim Attendees As New ArrayList Attendees.Add("Fred") Attendees.Add("Wilma") Attendees.Add("Barney") Attendees.Add("Betty")
The Count Property Dim Attendees As New ArrayList Dim ItemCount As Integer ItemCount = Attendees.Count
Index Numbers Rather like house numbers Zero bound (This will drive you mad!) ValueIndex Fred0 Wilma1 Barney2 Betty3
RemoveAt Method ValueIndex Fred0 Wilma1 Barney2 Betty3 Attendees.RemoveAt(2) Which record will be removed?
Changing a List Entry What will the following do? Attendees.Add("Fred") Attendees.Add("Wilma") Attendees.Add("Barney") Attendees.Add("Betty") Attendees.Item(2) = "Bamm Bamm"
Data Tables We said all of that to introduce this… qry_tblAddress_SelectAll SELECT * FROM tblAddress
Presentation Layer Code How do we get at the results of the query?
QueryResults HouseNumber = MyAddresses.QueryResults.Rows(1).Item("HouseNo") Street = MyAddresses.QueryResults.Rows(3).Item("Street") AddressNo = MyAddresses.QueryResults.Rows(0).Item("AddressNo") DateAdded = MyAddresses.QueryResults.Rows(3).Item("Active") CountyCode = MyAddresses.QueryResults.Rows(1).Item(“HouseNo") CountyCode = MyAddresses.QueryResults.Rows(4).Item(“CountyCode")