25 August, 2009

Session 11

* In this session we talked a little more about SQL - Structured Query Language.
* An SQL statement always starts with either SELECT, DELETE, UPDATE or INSERT.
* We can also add a FILTER to an SQL statement, for example:
"SELECT * FROM ApprovedTravelRequests WHERE FirstName = 'Janet'"
SELECT * = SELECT ALL
ApprovedTravelRequests = Name of Table
WHERE = Filter
FirstName = Field
* The above will return all the details for that person.
* We can also specify which details should be returned:
"SELECT Location FROM ApprovedTravelRequests WHERE FirstName = 'Janet'"
* The above will only return the details from the Location field.
* To return the details from more than one field we use a comma between the field names:
"SELECT Location, TripDates FROM ApprovedTravelRequests WHERE FirstName = 'Janet'"

21 August, 2009

Session 10

* There are four database operations, three of which cause changes: 1. insert; 2. delete; 3. update; 4. select (only opens it).
* When constructing a database, ID IS KING!!
* All databases must 1. have an ID column, 2. use the AutoNumber data type to populate this column, 3. have a primary key defined.
* The new version of Access does these three things for you!
* DO NOT have spaces in your field names - either use capitals or underscores.
* SQL stands for Structured Query Language.
* In SQL * means all, e.g. the command "Select * from TableName".
* When writing our code in Visual Basic, objects need to be connected to a database.
* Rachael used the following analogies:
1. Connection String - The Supermarket address.
2. Connection Object - The car.
3. Command Object - The shopping list.
4. DataAdapter Object - Mum doing the shopping.
5. DataSet Object - The pantry.

17 August, 2009

Session 9

* Today we started talking about databases.
* A database is a type of PERSISTANT data storage.
* There are 2 different types of database - 1. Flat file and 2. Relational.
* An example of a flat file database would be an Excel spreadsheet (it deals with only one topic).
* An example of a relational database would be an Access file (can contain many different areas of information).
* The common features of relational databases are: creating tables; populating tables; retrieving data; generating queries; generating reports.
* Each TABLE in a database deals with a specific topic of information.
* Every column in a table is called a FIELD.
* Every row in a table is called a RECORD.
* When you define a new field you must also define the data type, e.g. text, memo, number, date/time, yes/no, currency, etc.
* Using related tables reduces repetition of data.
* When you are working with databases understanding how the IDs work is crucial.
* The first thing you should do when you build a table is define an ID field.
* The AUTONUMBER data type in Access provides an automatically incremented, sequential and unique number for our IDs.
* Every table has one PRIMARY KEY - a unique identifying feature (field) for the table.

Databases

* A database is a method of storing, managing and retrieving related information using tables.
* Technically a database is anything that stores information, so telephone books, filing cabinets, dictionaries, etc. are all databases.
* In business, common databases are customer lists, product information, mailing lists, etc.

http://www.asp.net/learn/sql-videos/video-103.aspx is a link to a video tutorial about databases that all who have commented on it say is a good, easy to understand tutorial for beginners.

11 August, 2009

Session 8

* In todays class we talked about file handling (working with simple text files).
* We talked about performing tasks such as creating, writing, reading, deleting, moving and copying the text files.
* We had to import the class library for StreamReader and StreamWriter to the application as it was not automatically included: Imports System.IO
* We then added code to the click event of each button on our form to perform the desired task, e.g.
1. btnCreateFile - File.Create("C:\mycreatefile.txt")
2. btnWriteFile - Dim objWriter As New StreamWriter("C:\mywritefile.txt")
objWriter.WriteLine("I am NOT a multimedia rockstar!")
objWriter.Close()
3. btnReadLine - Dim objReader As StreamReader
objReader = File.OpenText("C:\mywritefile.txt")
txtFileContents.Text = objReader.ReadLine()
objReader.Close()
4. btnReadFile - as btnReadLine except .ReadToEnd() replaces .ReadLine()
5. btnMoveFile - File.Move ("C:\mycreatefile.txt", "E:\Chisholm\Rachael\mycreatefile.txt")
6. btnCopyFile - File.Copy("C:\mywritefile.txt", "E:\Chisholm\Rachael\mywritefile.txt")
7. btnDeleteFile - File.Delete("E:\Chisholm\Rachael\mywritefile.txt")

10 August, 2009

Chapter 9 project

On page 695, where they give you the details for designing the form, there is a slight typo in the text for the button - it reads Calculate Depression instead of Calculate Depreciation! It's only a small typo and nothing to worry about, but seeing as my head is already buzzing trying to make sense of this chapter, it at least afforded me a little chuckle!! My Calculated Depression - off the scale :o).

Session 7

* In todays class, after the Chapter 8 test, we talked in more detail about arrays.
* An array is a variable that can store more than one value.
* Each item in an array that contains a value is called an element.
* Arrays provide access to data by using a numeric index to identify each element.
* To initialize an array you must write a declaration statement that includes the name of the array, how many items it has to store, and what sort of data it can store.
* Setting the size of an array is called dimensioning the array.
* If you know the values to be placed in each element you can declare the the array by assigning values to the elements.
* Parallel arrays store data in two or more arrays.
* If a number is not used int he declaration statement the array us implicitly sized, i.e. the number of values is determined at execution.
* The other aspects of arrays covered in Chapter 9 are:
1. Initializing an array with default values.
2. Accessing array elements using a loop.
3. Array boundaries.
4. Reinitialising an array.
5. Using the length property.
6. Scope of arrays.
7. Passing an array.
8. Sorting an array.
9. Searching an array.
10. Two dimensional arrays.