2 Replies Latest reply on Jun 12, 2009 2:12 PM by ahmed.malik

    Adobe Air Problem with SQL Lite

    ahmed.malik Level 1

      Hi

       

      I am facing a strange, weired error.. and i am hating it

       

      SQLError: 'Error #3132: Data type mismatch.', details:'could not convert text value to numeric value.', operation:'execute', detailID:'2300'

       

      here is my code:

       

       

      stmt = new SQLStatement();

      stmt.text = "UPDATE PracticeTable SET UserAnswer=:userAnswer, TimeTaken=:timeTaken WHERE Primarykey=:primaryKey";

       

       

      stmt.parameters[":userAnswer"] = "C";

      stmt.parameters[":timeTaken"] = "10";

      stmt.parameters[":primaryKey"] = 141;

       

       

      stmt.sqlConnection = MySQLConnection.Instance.Connection;

      stmt.execute();

       

       

      following is my table

       

      CREATE TABLE "PracticeTable" ("PrimaryKey" INTEGER PRIMARY KEY  AUTOINCREMENT  NOT NULL  , "CategoryName" VARCHAR NOT NULL , "QuestionHTMLName" VARCHAR NOT NULL , "AnswerHTMLName" VARCHAR, "AnswerCorrectOption" VARCHAR, "NoOfOptions" INTEGER, "UserAnswer" VARCHAR, "TimeTaken" VARCHAR, "StatusOfAnswer" VARCHAR, "BookMark" VARCHAR, "RCJoin" VARCHAR DEFAULT 0, "SyncFlage" INTEGER NOT NULL  DEFAULT 0)

       

      I really can't figure out what's wrong, please someone helppppp !!!!

       

      Best regards,

      Ahmed.

        • 1. Re: Adobe Air Problem with SQL Lite
          jbenson@oper8 Level 2

          I'd try simplyfying my statement a bit and see if you still have the issue.  Perhaps your parameters are just not being interpreted as the right datatype before being executed

           

          stmt = new SQLStatement();

           

          var myParams = {userAnswer: "C", timeTaken: "10", primaryKey:141};

          stmt.text = "UPDATE PracticeTable SET UserAnswer='" + myParams.userAnswer + "', TimeTaken='" + myParams.timeTaken + "' WHERE Primarykey=" + myParams.primaryKey;

           

           

           

          stmt.sqlConnection = MySQLConnection.Instance.Connection;

          stmt.execute();

          • 2. Re: Adobe Air Problem with SQL Lite
            ahmed.malik Level 1

            Hi Jason

            Thanks for replying. There was a problem with default value in column

            SyncFlage. I removed and then added the mentioned column again. Now it works

            like a charm.

             

            Best regards,

            Ahmed.