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.
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.