Record a specific value from databse



  • Hi,

    I would like to record the value of a specific attribute selected from database. I need to record the numberId from a table in order to introduce this value into other table.

    I execute this function and I'm sure there is only one row with the same name attribute. But I don't know how to record the value to use it in the second function.

    function selectDB(name) {

    var Items = {}
    _DB.readTransaction( function(tx) {
    var rs=tx.executeSql("SELECT numberId FROM table1 WHERE name=?", [name]);
    var item
    for (var h=0; h<rs.rows.length; h++) {

    item = rs.rows.item(h)
    Items[item.name] = item;
    }
    })
    return Items
    }

    function insertDB(numerId){

    _DB.transaction(function(tx){
    tx.executeSql( "INSERT INTO table2 (numerId) VALUES (?)", [numberId])
    })}

    Thanks and sorry for my English.



Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.