10 Replies Latest reply on May 16, 2011 7:21 PM by Kristin95762

    how do I handle SQLStatement errors?

    Kristin95762

      I'm having trouble with the SQLErrorEvent.ERROR. I just want to open an alert window, but I get a Error#1010 A term is undefined and has not properties.

       

      I assume this error occurs precisely because there is no selectedItem, but how do I handle the error when that is the case?

       

      This solution needs to be as simple as possible because I'm pretty green.

       

      private function removeAuthorRecord():void

      {

      removeAuthorStmt = new SQLStatement();

      removeAuthorStmt.sqlConnection = conn;

       

       

      var sql:String = "DELETE FROM authors3 WHERE authorID = " + authorsList.selectedItem.authorID;

       

       

      removeAuthorStmt.text = sql;

       

      removeAuthorStmt.addEventListener(SQLEvent.RESULT, removeAuthorResult);

      removeAuthorStmt.addEventListener(SQLErrorEvent.ERROR, errorRemoveAuthor);

       

      removeAuthorStmt.execute();

      }

       

      private function errorRemoveAuthor(event:SQLErrorEvent):void

      {

      Alert.show("Please pick an author to delete");

      }

       

      Thanks

       

      Kristin