Monday, August 24, 2009

Databases Cont'

You can use relational operators which are
>
<
<=
>=
<>
=

anything with talking marks is case sensitive.
using % at the beginning of R will show what ends in R
% signs are called a wild card character
you can also put % at beginning and end and it will look at the beginning and end.
'This R% brings up locations starting with R
'%R anything that ends with R
'%R% starting and ending with R
'Use [] where a space has been inserted in name

logical operators
AND
OR
we can also use these in the expressions that we are making

And will only find from one section
Or will find from all sections

Concepts

Connection String - The supermarket
Connection Object - The car
Data Adapter - Mum doing the shopping
Command Object - The shopping list
DataSet Object - Pantry

* in sequel means ALL

SQL means Structured Query Language
Select
Delete
Update
Insert

WHERE filters where(it's a clause)

Monday, August 17, 2009

Database cont'

There are 4 different operations
delete
update
insert
select

2 different types of databases
flat file (excel spreadsheets)
relational (access)

manipulating a database
ID is King, it's all about ID

auto number
go to the data type in access
Access does not renumber id, there all all unique, even if they have been deleted
All of our tables will have an ID column that belongs to the table

Primary key
Suitablility - access is for single users or small business users.
limitation - not suitable for the internet.

SQL - structured query language, when we want to do our insert, update, delete etc

No spaces eva between anything in programming - capital or underscore

Generate reports and quiries with access

Sunday, August 16, 2009

Database

What is a database?
A database collects data in a structured format. This happens so that the information can be easily found, stored and managed.
Used by businesses and even the internet for this program.

What are the different types of databases?
Customer list
Product informaation
mailing list
reservation system
phonebook
gps

2 different types of data bases:
flat file(excel spreadsheet)
relational databases (access, this can contain many different areas of information)
Table: within a table there are
Every column in a table is known as a field
Every row in a table is known as a record.
ID: If we know the id, is all we need to find info (ID is King)

different ways to set up but the general principal:
Primary key - only one, therefore makes info easier to find.

Monday, August 10, 2009

File Handling - System.IO

File Handling

Systems IO file class
-Creating Files
-Deleting Files
-Moving
-Copying
-Opening

.StreamReader can read text - IO.StreamReader
StreamWriter can write text - IO.StreamWriter

Constructor is an ON SWITCH

Sunday, August 9, 2009

Chapter 9 - Arrays

Today we completed the chapter 8 test.
An Array

If you have
Dim My Array(5) As DataType
this means that there is 6 elements.from 0 - 5

Dim strNames(2) As String... has 3 elements.
we assign a value to each value in the index - egs..
strNames(0) = "Rach"
strNames(1) = "Pam"
strNames(2) = "David"

Declare and populate an array
This way you can have as many or as little as you like this way.
Dim chMenuOptions() As Char = {"a", "A", "b"}

loops

Dim strNames(2) As String
Loop to populate
Another array
Dim intDinnerBookings(2) As integer

(in memory) there will be the 3 strings (strnames)
and the 3 integers (intDinnerBookings)

you can match things up via the index

Dim ItemArray (3) As String = {"x", "y", "3"}
Dim intCount As Integer - - we have declared a count integer
For intCount= 0 To ItemArray.Length - 1
lstBoxItems.Add(ItemArray(intCount))ine of code is always going to return.

Next

intCount = 0 -- x
intCount = 1 -- y
inCount = 2 -- z

length returns the number of elements, not the upperbound

sorting an array
the data in an array often is sorted for an organised display.
So could be alphebetical etc
egs. Array.Sort(strNames)

Searching an array

Sequential - is searching for each element in an array
BinarySearch - method searches a sorted array for a value using a binary search algorithm. The binary search algorithm searcehd an array by repeating dividing the search interval in half.

Monday, August 3, 2009

Chapter 8 - exception handling

exception handling - handling errors

Try

intNumber = txtTextBox.Text
Catch ex As Exception


End Try

Try
intNumber = txtTextBox.Text
Catch ThisException As Exception<---> exception is a class
End Try

pg 592 - different exception types

Now to attempt the chapter.

Sunday, August 2, 2009

3/8/09 - test and Chapter 8

First part of the morning we completed our test and I handed in my radar and mystic assignments.
Now we are going through chapter 8
Procedures
Public Sub MyProcedure()<--- its a method that we require furthur information for further tasks -->
'Do something
End Sub

Function

Public Function DoesItEqualTen (intNumberOne As Integer,intNumberTwo As Integer? As Boolean <-- depends on info you want to return -->
Dim blnTrueOrFalse As Boolean = False
If intNumberOne + intNumberTwo = 10
blnTrueOrFalse = True
Else
blnTrueOrFalse = False

End Function
If IsNumeric(txtTextBox.text) Then
---
End If
ublic FUnction IsNumeric(stringToLookAt) As Boolean
End FUnction

By Val - object is duplicated and passed to the function
By Ref - WHen you type in an argument, you will get a byref, pass the reference to the function