Advanced AIR – simple SQLite CRUD Database

Again, some more source files from my upcoming Adobe TV Flash Downunder series on Advanced AIR in Flash Pro which I recorded a little while ago.

This time a simple CRUD database in AIR using SQLite. Apart from showing how to create an internal SQLite database file inside the AIR app, it also shows how to implement Create, Read, Update and Delete – CRUD entries in the database using SQL statements. I am also using a DataGrid to display the contents and the file shows how to format the DataGrid.

crud_db

How to interact with the database:
Create: To create an entry in the database type a name and number in the entry fields and click CREATE
Read: start typing letters in the name entry field and then click READ to display only names with the entered text
Update: Select a row in the DataGrid and then change it in the entry fields and click UPDATE
Delete: Select a row in the DataGrid and then click DELETE to remove it from the database
Reset: click RESET to display all the database entries

I have separated out all the SQL calls into functions so it is easy to see what is happening. You can use any SQLite calls – a good place to find available calls is http://www.sqlite.org/lang.html

You can download the source files here, and to see the AIR app working click on the AIR badge below.

Tags: , , ,

3 Responses to “Advanced AIR – simple SQLite CRUD Database”

  1. Paul Burnett – madblog » Blog Archive » Flash Downunder – Advanced AIR – CRUD Database Says:

    [...] source files for this episode are in an earlier blog post so you can download them and grab the [...]

  2. Alex Says:

    How would you create a delete all button

  3. paul Says:

    Hi Alex
    You would use the SQL command
    sql.text = “DELETE FROM contact WHERE ID LIKE ‘%’”
    Notice I am using % as a wildcard and it is in single quotes.

Leave a Reply