Special

Clearance Sale!

We've been publishing for over five years now and it's time to clear out our inventory of back issues, so we're slashing prices!

RBD Magazines

Check out this amazing clearance sale of all our past issues. Missing some issues? This is a great time to complete your RBD collection. Save up to 40% off the regular price of our printed back issue packages. These prices are only good until the end of the year May 2008 and supplies are limited, so place your order today.

Article Preview


Buy Now

Print:
PDF:

Databases for REAL

Back to the Basics

Issue: 3.1 (September/October 2004)
Author: Paul Lefebvre
Author Bio: Paul Lefebvre is President and Chief Architect of LogicalVue Software, producers of SQLVue, RBUnit, and other products.
Article Description: No description available.
Article Length (in bytes): 2,658
Starting Page Number: 32
RBD Number: 3114
Resource File(s):

Download Icon 3114.sit Updated: Wednesday, September 15, 2004 at 4:27 PM

Related Link(s): None
Known Limitations: None

Excerpt of article text...

This column will be much less technical than some past installments. We're going to simply go through, step-by-step, how to create and connect to a REALbasic 5.5 database.

Create the Database File

The first thing to do is to create a database file. In REALbasic 5.5, database files can be either a single file (actually a virtual volume) or a folder. A database in a folder is the faster of the two methods. Regardless of the method you choose, you will need a FolderItem.

Dim DbFile As FolderItem

DbFile = New FolderItem("DatabasesForReal")

Dim MyDatabase As REALDatabase

MyDatabase = New REALDatabase

MyDatabase.DatabaseFile = DbFile

If MyDatabase.CreateDatabaseFile Then

MsgBox "Database created!"

Else

Return

End If

Work with the Database

The MyDatabase instance gives you access to the newly created database. You can use this to add tables, indexes, and data. You can use MyDatabase to issue database queries and other commands. For example, to create a table:

MyDatabase.SQLExecute("CREATE TABLE sample (FirstName VarChar, LastName VarChar, Age Integer)")

...End of Excerpt. Please purchase the magazine to read the full article.

Article copyrighted by REALbasic Developer magazine. All rights reserved.


 


|

 


Weblog Commenting and Trackback by HaloScan.com