1 Reply Latest reply on May 28, 2010 3:31 PM by Joe ... Ward

    Error #3115: SQL Error.', details:'no such table




      I'm creating my Adobe Air App using Flash CS5 Professional and facing exactly the following error.


      SQLError: 'Error #3115: SQL Error.', details:'no such table: 'categories'', operation:'execute', detailID:'2013'


      My SQLite Db has been created using Firefox extension - SQLite Manager. The db file is placed into the same folder as the .fla and .swf files. The db has three tables namely: categories, period and activity. I don't understand why I'm getting this error. I have even tried copy pasting other source code from AS 3.0 reference guide but same error every time.


      The code below is a modified version of example code in AS 3.0 reference documentation. Can you suggest how the above error can be fixed?

      /you can also reply to me directly at nasiralisher@gmail.com





      import flash.data.SQLConnection;

      import flash.data.SQLResult;

      import flash.data.SQLStatement;

      import flash.display.Sprite;

      import flash.events.SQLErrorEvent;

      import flash.events.SQLEvent;

      import flash.filesystem.File;


      var conn:SQLConnection;

      var insertCategory:SQLStatement;

      var dbFile:File;







      function databaseConnect():void


      // define where to find the database file

      var appStorage:File = File.applicationStorageDirectory;

      dbFile = appStorage.resolvePath("MyBudgetCalc.db");


      // open the database connection

      conn = new SQLConnection();

      conn.addEventListener(SQLErrorEvent.ERROR, errorHandler);

      conn.addEventListener(SQLEvent.OPEN, openHandler);


      trace("dbFile.exists:"+ dbFile.exists);




      // Called when the database is connected

      function openHandler(event:SQLEvent):void


      conn.removeEventListener(SQLEvent.OPEN, openHandler);


      // start a transaction

      //Object(this).inputfield.text = "openHandler called.. ";

      conn.addEventListener(SQLEvent.BEGIN, beginHandler);


      trace("exiting openHandler..");



      // Called when the transaction begins

      function beginHandler(event:SQLEvent):void


      conn.removeEventListener(SQLEvent.BEGIN, beginHandler);


      //trace("beginHandler - SQLEvent message: "+SQLEvent.message);

      Object(this).inputfield.text = "beginHandler called.. ";

      insertCategory = new SQLStatement();

      insertCategory.sqlConnection = conn;

      insertCategory.text = "INSERT INTO categories(id, name) VALUES (', Auto')";



      insertCategory.addEventListener(SQLEvent.RESULT, insertCategoryHandler);

          insertCategory.addEventListener(SQLErrorEvent.ERROR, errorHandler);

      trace("exiting beginHandler..");



      // Called after the phone number record is inserted

      function insertCategoryHandler(event:SQLEvent):void


      insertCategory.removeEventListener(SQLEvent.RESULT, insertCategoryHandler);

      insertCategory.removeEventListener(SQLErrorEvent.ERROR, errorHandler);


      // No errors so far, so commit the transaction

      conn.addEventListener(SQLEvent.COMMIT, commitHandler);


      trace("exiting insertCategoryHandler after conn.commit()..");



      // Called after the transaction is committed

      function commitHandler(event:SQLEvent):void


      conn.removeEventListener(SQLEvent.COMMIT, commitHandler);

      trace("exiting commitHandler(): Transaction complete..");


      // Called whenever an error occurs

      function errorHandler(event:SQLErrorEvent):void


      trace("entering errorHandler()..");

      // If a transaction is happening, roll it back

      if (conn.inTransaction)


      conn.addEventListener(SQLEvent.ROLLBACK, rollbackHandler);





      trace("exiting errorHandler()..");



      // Called when the transaction is rolled back

      function rollbackHandler(event:SQLEvent):void


      conn.removeEventListener(SQLEvent.ROLLBACK, rollbackHandler);