SQL Connection using AIR - AS3
Hi guys, I'm currently developing a mobile app that have to connect itself to a MySQL database.
Googoling I found this code:
import flash.filesystem.File;
import flash.data.SQLConnection;
import flash.data.SQLStatement;
import flash.net.Responder;
var connection:SQLConnection;
openDatabase();
function openDatabase():void
{
var dbFile:File = File.applicationStorageDirectory.resolvePath("mySQL.db");
connection = new SQLConnection();
connection.addEventListener(SQLEvent.OPEN, onOpen);
connection.openAsync(dbFile, SQLMode.CREATE);
}
function onOpen(SQLEvent):void
{
var stat:SQLStatement = new SQLStatement();
stat.sqlConnection = connection;
stat.text = "CREATE TABLE IF NOT EXISTS contacts (id INTEGER PRIMARY KEY AUTOINCREMENT, fname TEXT, lname TEXT, phone INTEGER)";
stat.execute(-1, new Responder(selectItems));
}
function selectItems(SQLEvent):void
{
trace("Select items!");
}
But there's a problem!
Adobe Flash CS 5.5's compile gives me this error: "Access to a null or undefined property SQLMode"
...
Is there anyone that can help me?
Thanks!!!
Brandon