120 likes | 230 Vues
This overview delves into object-oriented programming concepts used for managing tabular data. It covers the system's layered architecture for maintainability and reuse, detailing the fundamentals of database structures such as queries, tables, and parameters. The discussion includes working with arrays and lists in code, manipulating data entries, and retrieving information through SQL queries. Key coding concepts like variables, controls, and functions are presented to enhance your understanding of data manipulation in programming.
E N D
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
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!) Value Index Fred 0 Wilma 1 Barney 2 Betty 3
RemoveAt Method Value Index Fred 0 Wilma 1 Barney 2 Betty 3 • 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")