0 Replies Latest reply on Jul 11, 2011 10:59 AM by JasonBr42

    Actionscript + SQlite error.... help!  (flex builder)

    JasonBr42

      Ok, I have narrowed down my error to have been coming in some way from the following code:

       

      [CODE]
      for (var i:int = 0; i < size; i++)
      {
      try
      {
         createStmt = new SQLStatement();               
         createStmt.sqlConnection = conn;
         var sqlInsert:String = "insert into FilesMaster (\"f_ID\", \"f_Name\", \"f_PreferredName\") values(" + model.getDataResult[i]["f_ID"] + ",'" + model.getDataResult[i]["f_Name"] + "','" + model.getDataResult[i]["f_PreferredName"] + "')";
         createStmt.text = sqlInsert;                       
         createStmt.execute();
      }
      catch(error:SQLError)
      {
         trace("Error message:", error.message);
         trace("Details:", error.details); 
      }
      }
      [/CODE]

       

      This code executes just fine, and the processing continues on to allow me to then add this table to a datagrid.  But once its done, I get the following error:

       

      [CODE]Error #2044: Unhandled SQLErrorEvent:. errorID=3115, operation=execute , message=Error #3115: SQL Error. , details=near 'index': syntax error
      Error #2044: Unhandled SQLErrorEvent:. errorID=3115, operation=execute , message=Error #3115: SQL Error. , details=near 's': syntax error[/CODE]

       

      The datagrid populates fine and the code executes as expected...

       

      but what does this error mean?

       


      I tried switching the above INSERT code with the following and i no longer got the SQL error...

       

      [CODE]
      createStmt = new SQLStatement();
      createStmt.sqlConnection = conn;               
      var sql:String = "INSERT INTO FilesMaster (f_ID, f_Name, f_PreferredName) VALUES(" + i.toString() + ",'moo','cat');";
      createStmt.text = sql;
      createStmt.addEventListener(SQLEvent.RESULT, insertResult);
      createStmt.execute();    [/CODE]