What's new
  • Visit Rebornbuddy
  • Visit Panda Profiles
  • Visit LLamamMagic
  • Visit Resources
  • Visit Downloads
  • Visit Portal
RebornBuddy Forums

Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your own topics and posts, as well as connect with other members through your own private inbox!

Learning to develop mobile apps with Flex 4.6 Could anyone help with a sqlite issue?

meef

Member
Joined
Jun 12, 2012
Messages
69
Hello; I am running into a very big roadblock since all the training I purchased "Curse you Video2brain.com!" does not seem to cover how to create, write to, extract, or send data to a sqlite database used for mobile air apps. Since im new to all of this the Tech heavy jargon that is involved is just beyond me right now. Would anyone be able to help with this area?


I have done the following code:

private function init():void
{
// ... create and open the SQLConnection instance named conn ...

{
var conn:SQLConnection = new SQLConnection();

conn.addEventListener(SQLEvent.OPEN, openHandler);
conn.addEventListener(SQLErrorEvent.ERROR, errorHandler);

var folder:File = File.applicationStorageDirectory;
var dbFile:File = folder.resolvePath("simplicity.db")

conn.openAsync(dbFile);
}

function openHandler (event:SQLEvent):void
{
trace("the database has been oponed");
}

function errorHandler(event:SQLErrorEvent):void
{
trace("Error message:", event.error.message);
trace("Details:", event.error.details);
}
var createStmt:SQLStatement = new SQLStatement();

createStmt.sqlConnection = conn;

var sql:String =
"CREATE TABLE IF NOT EXISTS stb (" +
" date INTEGER PRIMARY KEY AUTOINCREMENT, " +
" title TEXT, " +
" entry TEXT, " +
" " ;")";



createStmt.text = sql;

createStmt.addEventListener(SQLEvent.RESULT, createResult);
createStmt.addEventListener(SQLErrorEvent.ERROR, createError);

createStmt.execute();
}

private function createResult(event:SQLEvent):void
{
trace("Table created");
}

private function createError(event:SQLErrorEvent):void
{
trace("Error message:", event.error.message);
trace("Details:", event.error.details);
}


private function saveJournal():void
{

var statement:SQLStatement = new SQLStatement();
statement.text = "INSERT INTO stb (title , entry, date) VALUES ('"+title_txt.text+"','"+entry.text+"','"+date.text+"')";






statement.execute();

title_txt.text = "";
entry.text = "";

}
]]>
</fx:Script>

I am getting this error.

Error #3109: Operation is not permitted when the SQLStatement.sqlConnection property is not set.



I am hoping to get a database set up that can be accessed over different views. And email / Share the data selected data from the database archives.

Help would be greatly appreciated :)

thanks

Meef
 
Back
Top