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):
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.
|










