Hy,
i have this problem: my app have more screens. The first is main manù, the second screen is a screen of data entry in database.
For each instance, the first use of the app i can enter data into the database without problem, but if i go to back in menu and run the second screen (for the second time) my app don’t insert in database. I have insert my code in custom file of the menù screen (the first screen)
We can help me?
Thanks.
the code of access ed insert database is this:
Access database
function ApriDb()
{
if (window.openDatabase)
{
db = openDatabase(“Db”, “1.0”, “Database app”, 400000);
if (!db)
alert(“Impossibile aprire il database del dispositivo.”);
}
else
alert(“Impossibile accedere al database”);
}
Insert Database
function InsertMov()
{
if (FlagInsertimento==true)
{
db.transaction(function(tx) {
tx.executeSql(“SELECT COUNT(*) FROM Persone”, [], function(result) {
}, function(tx, error) {
tx.executeSql(“CREATE TABLE Persone (ID INTEGER PRIMARY KEY AUTOINCREMENT, Nome TEXT, Cognome TEXT, Indirizzo TEXT)”, [], function(result) { });
});
});
db.transaction(function (tx) {
tx.executeSql(“INSERT INTO Persone(Nome, Cognome, Indirizzo) VALUES (?, ?, ?)” , [$(‘#m1-Inserisci-Nome’).val(), $(‘#m1-Inserisci-Cognome’).val(), $(‘#m1-Inserisci-Indirizzo’).val()]);
});
alert(“Dati inseriti”);
}
}