Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Record a specific value from databse
Forum Updated to NodeBB v4.3 + New Features

Record a specific value from databse

Scheduled Pinned Locked Moved QML and Qt Quick
databasesqlsqlitesqlite databasefunctionproperty
1 Posts 1 Posters 934 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    Pisko
    wrote on 4 Oct 2015, 15:07 last edited by
    #1

    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.

    1 Reply Last reply
    0

    1/1

    4 Oct 2015, 15:07

    • Login

    • Login or register to search.
    1 out of 1
    • First post
      1/1
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved