Xojo Developers Spot Documentation

Easiest Database Application Ever! #

XDSAutoDatabase simplifies the development of SQLite database applications by writing all the code for the database manipulation at run-time. A developer can use the Xojo IDE to design the layout of their application by placing the controls on a “parent container” such as a canvas or any other RectControl/Control, thereby creating a database “form”. By associating the “parent container” control with an instance of the XDSAutoDatabase, the class knows what tables and columns will need to be create or used, and will even create the database if it doesn’t exist. Saving a single form/record is great, but what about complex database applications where other records are related to another record? No problem! XDSAutoDatabase can relate records to one another, and allows developers to implement more complex data manipulation should it be needed (ie Calculations based on input or output, before saving or after retrieving from the database). Need to add another control (ie TextField)? Just drop it on the “parent container” and don’t add another line of code! the XDSAutoDatabase will alter the database table automatically to add any additional columns or associations. Find that you no longer need a particular field/control? Remove it from the “parent control”/form and no code changes are needed! Imagine developing a full CRM application in less than a day or creating a To-Do, Recipe, or Library application in an hour or less!

**Updated 10/13/2017 to include SQLite/MySQL/PostgreSQL handling for Desktop & Web!
**iOS under development.

Try it out! See the demos and examples below to get started!

Yes No

Demo 1: Simple Knowledgebase Library #

In this demo, you will learn how to use the XDSAutoDatabase class to create a simple knowledgebase library where you can store notes, code snippets, or just about anything! The demo application takes 10 minutes to complete! In the next demo, we’ll create a contact management application with associated records (15 minutes to complete!)

Skip to the end to download the pre-made project demo!
To purchase a license to use XDSAutoDatabase in stand-alone projects, please visit the store.

1) First, begin a new Xojo desktop application and add the XDSAutoDatabase class and dependencies to your newly created project.

2) Design your layout:

Controls:

Control NameXojo Control
lstKnowledgeBaseListBox
LibraryFormCanvas
lblTitleLabel
cmdClearPushButton
cmdDeletePushButton
tLibTitleTextField
tDetailsTextArea
cmdSavePushButton
ADLibraryFormXDSAutoDatabase

3) Add/Create the following methods and events:

XDSADDemo - Window.Open

Sub Open() Handles Open
Dim myDatabase As New FolderItem
myDatabase = SpecialFolder.Documents.Child("KnowledgebaseLibrary.sqlite3")

If ADLibraryForm.Initialize(LibraryForm,myDatabase,"Library",Nil,"") Then
ADLibraryForm.HeaderAlias.Value("tLibTitle") = "Library Listing"
LoadLibrary()
//Everything is Ready
Else
MsgBox "A problem occurred and the database could not be loaded."
Quit()
End If
End Sub

XDSADDemo - Window Method: LoadLibrary()

Public Sub LoadLibrary()
ADLibraryForm.ListboxRecords(lstKnowledgeBase, "tLibTitle",False)
End Sub

XDSADDemo - lstKnowledgeBase.Change

Sub Change() Handles Change
ADLibraryForm.LoadRecord(me.AutoDBRecord)
End Sub

XDSADDemo - cmdClear.Action

Sub Action() Handles Action
ADLibraryForm.ClearForm()
End Sub

XDSADDemo - cmdSave.Action

Sub Action() Handles Action
If Len(tLibTitle.Text.Trim) = 0 Or Len(tDetails.Text.Trim) = 0 Then
MsgBox "Title and Details are required to save."
Exit
End If

ADLibraryForm.SaveForm()

tDetails.Text = ""
tLibTitle.Text = ""

LoadLibrary()
End Sub

XDSADDemo - cmdDelete.Action

Sub Action() Handles Action
ADLibraryForm.DeleteRecord()
LoadLibrary()
End Sub

Download Project:

XDSAutoDatabase – Knowledgebase/Library Demo #1

Yes No

Demo 2: Contact Manager with Notes Demo #2 #

In this demo, you will learn how to create a multi-record-relational database application. From scratch, the application takes less than 15 minutes to design and code. In this demo, the database is included to show that data can be pulled from Aliased Column names (see the Initialize Event for The Notes Form), so that any database can be integrated into your application, regardless of if the XDSAutoDatabase classes had created the database. Relating an entire “parent container/form” takes a single line of code, and the classes take care of the rest!

Download the demo application and code:

XDSAutoDatabase – Contact Manager with Notes Demo #2

**Extract contents of demo zip archive to a folder named “AutoDB” on your DESKTOP for testing SQLite. The database has been hard-coded into the demo, and may be altered at will.

**Updated 10/13/2017 to include SQLite/MySQL/PostgreSQL handling for Desktop & Web!
**iOS under development.

**Screenshots taken at different times. See notes in source code.

Yes No