1 Reply Latest reply on Dec 20, 2008 2:40 AM by tackle mcclean

    SQLStatement.parameters not working inside .text properly? What am I doing wrong

    tackle mcclean
      I'm having trouble with parameters in the SQLStatement class. Look at this code:

      var stmt:SQLStatement = new SQLStatement;
      stmt.text = "INSERT INTO user VALUES(@title, @firstname, @lastname)";
      stmt.parameters["@title"] = "Mr";
      stmt.parameters["@firstname"] = "Simon";
      stmt.parameters["@lastname"] = "Whatley";
      trace(stmt.text);
      trace(stmt.parameters["@title"]);

      Now, you would expect this to trace the stmt.text as "...Simon, Whatley)"
      However, this is my trace:

      INSERT INTO user VALUES(@title, @firstname, @lastname)
      Mr

      So, this means the parameters are working great on their own, but just not inside the .text property?
      Or is this the way it's suppose to show, and to be converted later on in the execute method?
      I've tried both with "@" and ":" as parameter declaration.