I want to add my editbox data to a local table?

96 views Asked by At

How can I add a data to a local table from editbox. I have done many changes to my code onButton click.

I have added this code

Data.execute("insert into Sample_Table values('Name')",Pages.Page1.EditBox1.text);
alert(Pages.Page1.EditBox1.text); 

But my data is not added in Sample_Table. How can I add data to it if anybody can help.

1

There are 1 answers

0
merve bıçakçı On BEST ANSWER

There is a very helpful document about dataset queries, you should check it : http://www.smartface.io/developer/guides/data-network/sql-query-execution/

Try the code below :

var myEditbox = new SMF.UI.EditBox({
        left : "10%",
        top : "20%",
        text : ""
    });
var myButton1 = new SMF.UI.TextButton({
        left : "10%",
        top : "40%",
        text : "create insert",
        onPressed : function (e) {
            Data.execute("Create table Sample_Table (col1 int)");
            Data.execute("insert into Sample_Table (col1) values(?)", myEditbox.text);
        }
    });
var myButton2 = new SMF.UI.TextButton({
        left : "10%",
        top : "60%",
        text : "value",
        onPressed : function (e) {
            var myValue = Data.execute('select col1 from Sample_Table where rowId = 1');
            alert(myValue);
        }
    });

Add these 3 objects to your page, it will work.