Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8691703
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T00:10:25+00:00 2026-06-13T00:10:25+00:00

I am getting this error when I am trying to use the SQL UPDATE

  • 0

I am getting this error when I am trying to use the SQL UPDATE with a mobile application I am making in Flex builder. I have tried to search it up and removed parameters but even then I get the same code. Any help would be much appreciated

SQLError: 'Error #3115: SQL Error.', details:'Mismatch in parameter count. Found 6 in SQL specified and 5 value(s) set in parameters property.
', operation:'execute', detailID:'1004'
    at flash.data::SQLStatement/internalExecute()
    at flash.data::SQLStatement/execute()
    at model::SQLiteDatabase$/updateMember()[/Users/stokhofdavey/Documents/Adobe Flash Builder 4.6/MenuPlannerApplication/src/model/SQLiteDatabase.as:175]
    at views::MemberDetailsView/onSaveButtonClicked()[/Users/stokhofdavey/Documents/Adobe Flash Builder 4.6/MenuPlannerApplication/src/views/MemberDetailsView.mxml:25]
    at views::MemberDetailsView/___MemberDetailsView_Button3_click()[/Users/stokhofdavey/Documents/Adobe Flash Builder 4.6/MenuPlannerApplication/src/views/MemberDetailsView.mxml:45]

Here is the MXML code:

<?xml version="1.0" encoding="utf-8"?>
<s:View xmlns:fx="http://ns.adobe.com/mxml/2009"
        xmlns:s="library://ns.adobe.com/flex/spark"
        xmlns:ns1="*"
        title="Member Details">
    <fx:Script>
        <![CDATA[
            import model.Dish;
            import model.Member;
            import model.SQLiteDatabase;



            protected function onHomeButtonClicked(event:MouseEvent):void {
                navigator.popView();
            }

            protected function onSaveButtonClicked():void {
                var editNote:Member = new Member();
                editNote.FirstName = efirstname.text;
                editNote.FamilyName = efamilyname.text;
                editNote.Sex = esex.text;
                editNote.Age = eage.text;
                editNote.Notes = enotes.text;
                SQLiteDatabase.updateMember(editNote);

                currentState = "Info";
            }


        ]]>
    </fx:Script>

    <s:states>
        <s:State name="Info"/>
        <s:State name="Favorites"/>
        <s:State name="EInfo"/>
        <s:State name="EFavorites"/>
    </s:states>
    <s:navigationContent>
        <s:Button label="Back" click="navigator.popView();"/>
    </s:navigationContent>
    <s:actionContent>
        <s:Button includeIn="Info" label="Edit" click.Info="this.currentState=&quot;EInfo&quot;"/>
        <s:Button includeIn="EInfo" label="Save" click="onSaveButtonClicked()"/>

    </s:actionContent>
    <fx:Declarations>
        <!-- Place non-visual elements (e.g., services, value objects) here -->
    </fx:Declarations>


    <s:VGroup x="245" y="10" width="100%" height="354" gap="0"  >
        <ns1:TabMemInfoS includeIn="Favorites" width="60" height="40"/>
        <ns1:TabMebInfoL includeIn="Info" width="70" height="40"/>
        <ns1:TabMemFavoritesS includeIn="Info" width="60" height="40"/>
        <ns1:TabMebInfoL includeIn="EInfo" width="70" height="40"/>
        <ns1:TabMemFavoritesS includeIn="EInfo" width="60" height="40"/>
        <ns1:TabMemInfoS includeIn="EFavorites"/>
        <ns1:TabMemFavoritesL includeIn="EFavorites"/>
        <ns1:TabMemFavoritesL includeIn="Favorites" width="70" height="40"/>
    </s:VGroup>
    <s:Label id="FirstName" includeIn="Info" x="87" y="15" width="148" height="29" text="{data.FirstName}" textAlign="center"
             verticalAlign="middle"/>
    <s:Label id="FamilyName" includeIn="Info" x="87" y="46" width="148" height="29" text="{data.FamilyName}" textAlign="center"
             verticalAlign="middle"/>
    <s:Label id="Age" includeIn="Info" x="9" y="97" width="70" height="31" text="{data.Age}" textAlign="center"
             verticalAlign="middle"/>
    <s:Label id="Sex" includeIn="Info" x="87" y="97" width="70" height="31" text="{data.Sex}" textAlign="center"
             verticalAlign="middle"/>
    <s:Label id="notes" includeIn="Info" x="10" y="150" width="225" height="204" text="{data.Notes}"/>

    <s:Group includeIn="EInfo" width="246" height="364">
        <s:TextInput id="efirstname" x="83" y="10" width="150" text="{data.FirstName}" />
        <s:TextInput id="efamilyname" x="83" y="47" width="150" text="{data.FamilyName}"  />
        <s:TextInput id="eage" x="108" y="88" width="90" text="{data.Age}" />
        <s:TextInput id="esex" x="10" y="88" width="90" text="{data.Sex}" />
        <s:TextArea id="enotes" x="9" y="162" width="227" height="192" text="{data.Notes}" />
    </s:Group>

</s:View>

and the 2 .as files:
SQLiteDatabase

 package model
{
    import flash.data.SQLConnection;
    import flash.data.SQLResult;
    import flash.data.SQLStatement;
    import flash.events.SQLEvent;
    import flash.filesystem.File;
    import flash.filesystem.FileMode;
    import flash.filesystem.FileStream;
    import model.Dish;
    import model.Member;

    import mx.collections.ArrayCollection;

    public class SQLiteDatabase
    {
        private static var _sqlConnection:SQLConnection;

        public static function get sqlConnection():SQLConnection
        {
            if (_sqlConnection)
                return _sqlConnection;
            openDatabase(File.desktopDirectory.resolvePath("test.db"));
            return _sqlConnection;
        }


        public static function getNote(id:int):Dish
        {
            var sql:String = "SELECT id, title, time, message FROM notes WHERE id=?";
            var stmt:SQLStatement = new SQLStatement();
            stmt.sqlConnection = sqlConnection;
            stmt.text = sql;
            stmt.parameters[0] = id;
            stmt.execute();
            var result:Array = stmt.getResult().data;
            if (result && result.length == 1)
                return processRow(result[0]);
            else
                return null;
        }

        public static function getMYBlist(id:int):Dish
        {
            var sql:String = "SELECT id, title, time, message FROM notes WHERE id=?";
            var stmt:SQLStatement = new SQLStatement();
            stmt.sqlConnection = sqlConnection;
            stmt.text = sql;
            stmt.parameters[0] = id;
            stmt.execute();
            var result:Array = stmt.getResult().data;
            if (result && result.length == 1)
                return processRow(result[0]);
            else
                return null;
        }

        public static function notes():ArrayCollection
        {
            var noteList:ArrayCollection = new ArrayCollection();

            var sql:String = "SELECT id, title, time, message FROM notes";
            var stmt:SQLStatement = new SQLStatement();
            stmt.sqlConnection = sqlConnection;
            stmt.text = sql;
            stmt.execute();
            var sqlResult:SQLResult = stmt.getResult();
            if (sqlResult) {
                var result:Array = sqlResult.data;
                if (result) {
                    for (var index:Number = 0; index < result.length; index++) {
                        noteList.addItem(processRow(result[index]));
                    }
                }
            }
            return noteList;
        }

        public static function members():ArrayCollection
        {
            var noteList:ArrayCollection = new ArrayCollection();

            var sql:String = "SELECT FirstName, FamilyName, Sex, Age, Notes FROM Members";
            var stmt:SQLStatement = new SQLStatement();
            stmt.sqlConnection = sqlConnection;
            stmt.text = sql;
            stmt.execute();
            var sqlResult:SQLResult = stmt.getResult();
            if (sqlResult) {
                var result:Array = sqlResult.data;
                if (result) {
                    for (var index:Number = 0; index < result.length; index++) {
                        noteList.addItem(processRow2(result[index]));
                    }
                }
            }
            return noteList;
        }


        public static function addNote(note:Dish):void
        {
            var sql:String = 
                "INSERT INTO notes (title, time, message) " +
                "VALUES (?,?,?)";
            var stmt:SQLStatement = new SQLStatement();
            stmt.sqlConnection = sqlConnection;
            stmt.text = sql;
            stmt.parameters[0] = note.title;
            stmt.parameters[1] = note.time;
            stmt.parameters[2] = note.message;
            stmt.execute();
        }

        public static function addMember(note:Member):void
        {
            var sql:String = 
                "INSERT INTO notes (FirstName, FamilyName, Age, Sex, Notes) " +
                "VALUES (?,?,?,?,?)";
            var stmt:SQLStatement = new SQLStatement();
            stmt.sqlConnection = sqlConnection;
            stmt.text = sql;
            stmt.parameters[0] = note.FirstName;
            stmt.parameters[1] = note.FamilyName;
            stmt.parameters[2] = note.Age;
            stmt.parameters[3] = note.Sex;
            stmt.parameters[4] = note.Notes;
            stmt.execute();
        }

        public static function deleteNote(note:Dish):void
        {
            var sql:String = "DELETE FROM notes WHERE id=?";
            var stmt:SQLStatement = new SQLStatement();
            stmt.sqlConnection = sqlConnection;
            stmt.text = sql;
            stmt.parameters[0] = note.id;
            stmt.execute();
        }

        public static function deleteMember(note:Dish):void
        {
            var sql:String = "DELETE FROM notes WHERE id=?";
            var stmt:SQLStatement = new SQLStatement();
            stmt.sqlConnection = sqlConnection;
            stmt.text = sql;
            stmt.parameters[0] = note.id;
            stmt.execute();
        }

        public static function updateNote(note:Dish):void
        {
            var sql:String = "UPDATE notes SET title=?, time=?, message=? WHERE id=?";
            var stmt:SQLStatement = new SQLStatement();
            stmt.sqlConnection = sqlConnection;
            stmt.text = sql;
            stmt.parameters[0] = note.title;
            stmt.parameters[1] = note.time;
            stmt.parameters[2] = note.message;
            stmt.parameters[3] = note.id;
            stmt.execute();
        }

        public static function updateMember(note:Member):void
        {
            var sql:String = "UPDATE Members SET FirstName=?, FamilyName=?, Sex=?, Age=?, Notes=? WHERE ID=?";
            var stmt:SQLStatement = new SQLStatement();
            stmt.sqlConnection = sqlConnection;
            stmt.text = sql;
            stmt.parameters[0] = note.FirstName;
            stmt.parameters[1] = note.FamilyName;
            stmt.parameters[2] = note.Sex;
            stmt.parameters[3] = note.Age;
            stmt.parameters[4] = note.Notes;            
            stmt.execute();
        }


        protected static function processRow(o:Object):Dish
        {
            var note:Dish = new Dish();
            note.id = o.id;
            note.title = o.title == null ? "" : o.title;
            note.time = o.time == null ? "" :o.time;
            note.message = o.message == null ? "" : o.message;
            return note;
        }

        protected static function processRow2(o:Object):Member
        {
            var info:Member = new Member();
            info.ID = o.ID;
            info.FirstName = o.FirstName == null ? "" : o.FirstName;
            info.FamilyName = o.FamilyName == null ? "" : o.FamilyName;
            info.Sex = o.Sex == null ? "" : o.Sex;
            info.Age = o.Age == null ? "" : o.Age;
            info.Notes = o.Notes == null ? "" : o.Notes;

            return info;
        }


        public static function openDatabase(file:File):void
        {
            var newDB:Boolean = true;
            if (file.exists)
                newDB = false;
            _sqlConnection = new SQLConnection();
            _sqlConnection.open(file);
            if (newDB)
            {
                createDatabase();
                populateDatabase();
            }
        }

        protected static function createDatabase():void
        {
            var sql:String = 
                "CREATE TABLE IF NOT EXISTS notes ( "+
                "id INTEGER PRIMARY KEY AUTOINCREMENT, " +
                "title VARCHAR(50), " +
                "time VARCHAR(50), " +
                "message VARCHAR(200))"
                "CREATE TABLE IF NOT EXISTS members ( "+
                "id INTEGER PRIMARY KEY AUTOINCREMENT, " +
                "title VARCHAR(50), " +
                "time VARCHAR(50), " +
                "message VARCHAR(200))"
                ;
            var stmt:SQLStatement = new SQLStatement();
            stmt.sqlConnection = sqlConnection;
            stmt.text = sql;
            stmt.execute();         
        }

        protected static function populateDatabase():void
        {
            var file:File = File.applicationDirectory.resolvePath("assets/notes.xml");
            if (!file.exists) return;
            var stream:FileStream = new FileStream();
            stream.open(file, FileMode.READ);
            var xml:XML = XML(stream.readUTFBytes(stream.bytesAvailable));
            stream.close();
            for each (var n:XML in xml.note)
            {
                var note:Dish = new Dish();
                note.id = n.id;
                note.title = n.title;
                note.time = n.time;
                note.message = n.message;
                addNote(note);
            }
        }

    }
}

and
member.as

    package model
{
    import mx.collections.ArrayCollection;
    import mx.core.IUID;

    [Bindable]
    public class Member implements IUID
    {
        public var ID:int;
        public var FirstName:String;
        public var FamilyName:String;
        public var Sex:String;
        public var AgeID:int;
        public var Notes:String;
        public var Fname:String;
        public var Famname:String;
        public var Age:String;




        public function get uid(): String {
            return ID.toString();
        }

        public function set uid(value: String): void {
            ID = parseInt(value);
        }
    }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T00:10:27+00:00Added an answer on June 13, 2026 at 12:10 am

    Your SQL command is:

    UPDATE Members SET FirstName=?, FamilyName=?, Sex=?, Age=?, Notes=? WHERE ID=?
    

    But you are setting only the parameters for the five fields to be updated:

    stmt.parameters[0] = note.FirstName;
    stmt.parameters[1] = note.FamilyName;
    stmt.parameters[2] = note.Sex;
    stmt.parameters[3] = note.Age;
    stmt.parameters[4] = note.Notes;            
    

    You also have to set the ID value.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to use a function pointer and I am getting this error:
Im trying to use Date Formatters (NSDateFormatter), but I keep getting this error: Program
I'm getting this error displayed on my screen I have been trying to debug.
I am getting this error message: --------------------------- You have an error in your SQL
Ok, when trying to insert into the database I'm getting this error You have
I am new to php and I am getting this error trying to load
I´m getting this error while trying to commit to a svn repository: svn: MKACTIVITY
I'm getting this error when trying to access my webservice running inside tomcat. Caused
I am getting this error when trying to merge TFS2008. There are no pending
I keep getting this error while trying to modify some tables. Here's my code:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.