Posts Tagged ‘DataGrid’

Advanced AIR – simple SQLite CRUD Database

Tuesday, November 10th, 2009

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.