Blog 11 – Week 14

This week we covered some more information and examples that we can use in our applications.

For example:
DataGridView events
Using DataGridView to manipulate data
Creating a user in MySQL

Mostly though it was just focus on working on our applications.

Blog 10 – Week 13

This week we looked into using GUI components with our Data Access class and did more on linq.

Specifically we looked at using data from our database to populate a datagridview table in our application through use of data binding. This is done by using the ‘datasource’ property of the datagridview element.

Blog 09 – Week 12

This week we covered exceptions and more on Linq.

Exceptions can be utilized with the ‘try’, ‘catch’ and ‘finally’ in order to handle potential errors and keep a program running.
‘try’ will execute as any other piece of code but will, in the case of an exception, execute any code in the ‘catch’ block, then the optional ‘finally’ block will run, even if there was no exception.

Blog 08 – Week 11

This week we had a look at isolation levels and linq.

Isolation levels allows you to define how select statements work during the execution of a transaction and can be one of four types:
Read uncommitted
– allows for reading of data as it is currently in the database.
Read committed
– allows for reading of committed data in the database.
Repeatable read
– allows for reading of data in the database as it was when the transaction began.
– allows for reading of unlocked data in the database, waits if necessary data is locked.

Linq allows you to use to use a syntax similar to the SQL select statement in C# and is used in the following order:
from thing1 in thing2
select thing1

Blog 07 – Week 10

This week we looked into how we would set up the console app that is required in Milestone 2.
This involved looking into using a data access class to communicate with our database and then calling methods in the data access class to interact with the database from our console app.

Blog 06 – Week 9

This week we are continuing from week 8 and covering subqueries, referential integrity and cascades.

Subqueries are a select statement within another select statement and are used to obtain data from the database that is necessary for the containing query.
Referential integrity allows you to put constraints on the database. For example, it can stop you from deleting data from a table that is required by another set of data in the database.
Cascades are used in the deleting of data and are an extension to referential integrity. This causes the dependant data to be deleted along with the data it is dependant on.

Blog 05 – Week 8

This week we covered more on ‘Group by’ and ‘Having’ as well as users, permissions, procedures and functions.

Users and permissions control who is allowed to do what in the database, the default user being ‘root’ with full control. This allows you to keep certain users from having access to things that they should not have. For example, you might disallow some users from being allowed to run certain procedures or functions.

Procedures and functions allow for the controlled execution of SQL code at a specified point in time (when they are called). For example adding a new set of data to the database.

Blog 04 – Week 7

This week we covered MySQL ‘Group by’ and it’s extension ‘Having’.
‘Group by’ groups the output of a select statement by combining rows that have a column with repeating data, which can then be filtered using the ‘Having’ statement.
SELECT data1, data2
FROM table
GROUP BY data1
HAVING data1 > 3

Blog 03 – Week 6

This week we covered SQL Joins, handed in Milestone One and started work on Milestone Two.

Joins are used to combine two tables using a column from each table that is used to find matching data that determines what is joined. This can be used to find relevant data from other tables using a select statement.
SELECT tableOneData, tableTwoData
FROM tableOne as t1
JOIN tableTwo as t2
ON t1.exampleColumn = t2.exampleColumn

Blog 02 – Week 5

This week we learnt about the following SQL functionalities:

Alter Table:
The update command allows you to add a column, alter a column, rename a column, drop a column and rename a table.

Allows you to update the contents of a table

Use this statement to insert or update data in database tables.

This allows you to delete data from a single table.

Delete using cascade
Using this method of delete must be done proactively while setting up foreign keys, the database itself then automatically deletes the appropriate entries.

Delete with join
This method of deleting entries is basically a manual version of the ‘delete using cascade’.

We also learnt about using C# with SQL, however this is something I need to look into more before I understand it better.