Tuesday 22 September 2009

LOGIN OPERATION - LIBRARY SYSTEM

A little bird told me that a login form should be incorporated into the Library System that TESDA will ask you to design during the CoC1 exam. This is easy to implement. Really, no kidding.

You're gonna need a new form with 2 textboxes in it and 2 command buttons. Name the textboxes as tbUsername and tbPassword and the command buttons as cbLogin and cbCancel. When the user presses cbLogin, your application should connect to the database and check for records with matching username and password as those inputted on the textboxes. Here's the SQL for this:

SELECT mem_name, mem_id FROM members, accounts WHERE members.mem_id = accounts.mem_id and mem_username = '(insert tbUsername.Text here)' AND mem_password = '(insert tbPassword.Text here)'

To explain, you're simply telling SQL to get the member name and the member id of the record from the members database where the members id matches the member id in the accounts database who's username and password matches those inputted by the user in your textboxes.

LIBRARY SYSTEM - SAMPLE DATABASE Part 2

The RESERVATIONS Table
There are 3 fields in this table, the last one is optional though. The first is book_id(Integer) which identifies the book being reserved. Next is the mem_id(Integer) that identifies who is reserving the book. The last field I called is_granted(Integer) , it acts as a switch. I give it a value of one (1) if the reservation has been granted - ie. an Admin has lent the book to the member who reserved it - and zero (0) if not.

The TRANSACTIONS Table
This table is used to keep track of books that were borrowed. There are 5 fields in all. They are book_id(Integer), mem_id(Integer), date_borrowed(Short Date), overdue_date(Short Date), and date_returned(Short Date).

So, there's the libsys database that I'm using for practice. Next up will be the operations that your Library System should be able to perform. I'll post it after I finish my breakfast consisting of a cup of coffee and 1 or 2 marlboros :p

Monday 21 September 2009

LIBRARY SYSTEM - SAMPLE DATABASE Part 1

Before anything, I would just like to share my frustration at not being given a definite date for assessment by TESDA. Sobra! How hard could it be to schedule an assessment? I mean, we have an assessment center here in our place mismo kaso they told me I should go to TESDA for scheduling. So I did. They told me "inuuna muna namin yung mga PGS." So paano na yan? Hay!!!

Enough with the rant; as promised, I'm gonna describe my sample practice database. I named my database as libsys.mdb (MS Access). It currently has 5 tables namely: books, members, accounts, reservations, and transactions.

The BOOKS Table
It has 6 fields namely book_id(autoNumber), book_title(Text), book_author(Text), book_desc(Memo), book_isbn(Text), quantity(Integer), and books_left(Integer). All the fields are self-explanatory except maybe the books_left. I use that to designated how many books are left that's available for borrowing. Ex. quantity is 5, books_left is 2, so that means 3 books are either rented or reserved, and there are 2 more available. Primary key is book_id.

The MEMBERS Table
The fields are mem_id(AutoNumber), mem_name(Text), mem_addr(Text), mem_contact(Text), and mem_role(Text). Again they are self-explanatory. mem_role value is either "admin" or "member". Primary key is mem_id.

The ACCOUNTS Table
The fields are mem_id(Integer), mem_username(Text), and mem_password(Text). No primary key here. Take note that the mem_id should correspond to the mem_id on the MEMBERS table.

Next post will be the 2 remaining tables. Please remember, this is NOT THE ACTUAL DATABASE FOR THE NC4 PROGRAMMING EXAM. It's just my test data for my own practice sessions.

Also, this should really be stressed: YOU CAN'T POSSIBLY PASS THE EXAM IF YOU DON'T KNOW HOW TO CONNECT TO DATABASES AND ACCESS THEIR TABLES. Please practice how these operations are performed. I've given some links on the previous post for tutorials on how to set these up. Later...

Sunday 20 September 2009

COC1 - NC4 PROGRAMMING - LIBRARY SYSTEM

A lot of Programming NC4 holders say this is easy. I've been doing some coding practice on my own and it's definitely not that hard. As long as you know how to use ADODC controls and how to create ADODB objects thru code, your good to go, provided that you know how to handle Recordsets and their contents.

There are a lot of tutorials all over the net for this kind of operation using vb6. I found this site within seconds using Google: ADODC Tutorial.

For manipulating Recordsets, I found this one: Manipulating Recordsets. This is actually a complete tutorial on creating ADO objects via code and manipulating its recordset.

I'm told that if you know the above operations, then you're likely to pass the exam. If not, you'll fail. Practice, practice, practice. That's all there is to it. Oh and before I forget, you need to be able to create a database using Access too. It's not required for the Programming NC4 exam, it's just that you're going to need it for your practice sessions. You must be able to create a test database to work on. Here's a turorial about this: Creating Databases Using Access.

On my next post, I'll give you the table structure of my test database. It's not the same as what TESDA will provide for the exam but I'm pretty sure it's close enough, so stay tuned. Ciao.

Saturday 19 September 2009

NC4 PROGRAMMING EXAM CONTENTS

As far as i know, you need to have two CoC's (Certificate of Competency) to be granted an NC4. CoC 1 is for Object Oriented Programming and CoC2 is for Procedural Programming. In short, in order to be eligible for an NC4 certificate, you need to pass the CoC 1 exam and the CoC 2 exam.

As stated above, CoC1 is for Object Oriented Programming. Since most programming languages being used today are capable of being Object Oriented, this is quite in a broad sense. To be more specific, COC1 requires the creation of a GUI-based database application.

CoC2 is Procedural Programming. Although it implies that you need to use procedural programming languages, like Basic and Cobol (i think), this is not the case. You can use any programming language, even OO languages like Java. But why did they call it Procedural Programming? I guess TESDA is referring to the output to be generated. That's right, output should be DOS-based and text-only, no fancy GUI's, etc.

Since i haven't taken the exam yet, I can't specifically tell you the entire coverage of the exam. All I know at this time is that in CoC1, applicants are asked to design a LIBRARY SYSTEM using a database as a backend, while in CoC2, they are asked for a WEEKLY PAYROLL REPORT using text files as data sources. I'll post more later.