Visitors to VTC.com will be able to view all introductory videos for each training course.
Free Trial Members will gain access to first three chapters for each training course.
Full Access Members have full access to VTC.com�s entire library of video tutorials.
Now let's work on connecting to our database. First let us add the create table SQL to our project. Simply drag the file into our data access folder and we will append SQL to the name. Now let's create a new module, this will be our database controller. This module will be responsible for connecting to the database, creating the schemer on the database, and maintaining the actual object that connects to the database. So let's add some of these items to the module. First we will create a constant containing the name of the database file. We will also add a property to contain the reference to the database. We will add our method to connect to the database. To connect to the database we need to create a new instance of real SQL database, also known as SQLite. We also need to put this database somewhere. We will use the application data folder. This code here creates a new folder in the application data folder for the operating system, and then within that folder it creates the actual database file. If this database file already exists, we will simply connect to it. But if it does not exist we need to actually create the database SQLite file and then we need to create the schemer within the database file. We return the status of the connection, true means we connected successfully to the database, false means we did not. Now let's implement the create database schemer method. To create the schemer we simply need to run the create table command that we dragged into the project. We should do a little bit more error handling here though. Lets have this method return a boolean true if the schemer was created, false if it was not. And let's also check for any database errors. We need to now implement the is error method. If there is an error we will simply display it in a message box. Now we can go back to our connect to database method, since create database schemer now returns a value, we need to actually capture that value. We should also change the setting here so that this is public and has to be called by saying database controller dot connect to database. We leave ToDo DB as global so that we can refer to the ToDo database anywhere in the application by writing ToDo DB.
| Course: | Real Studio |
| Author: | Paul Lefebvre |
| SKU: | 34190 |
| ISBN: | 1-936334-77-1 |
| Release Date: | 2011-02-02 |
| Duration: | 7 hrs / 87 lessons |
| Work Files: |
Yes |
| Captions: | No |
| Compatibility: |
Vista/XP/2000, OS X, Linux QuickTime 7, Flash 8 |