How to update multiple columns in SQlite expo ?

this is insert but i want update this value :

Hi. It’s not clear to me what exactly you’re trying to do.

You should be able to update multiple columns using something like:

UPDATE Names
SET dbdate = '2021-01-18', dbnotes = 'Some notes', dbtype = 'notetype'
WHERE track_id = 1

But your INSERT OR REPLACE should also update multiple fields if there is already a record with a matching primary key.

1 Like

but dont work with dynamic parameters i try pass with es6 ${}

this way to pass parameters in the tx function works :

const addName = (dater, noter, serviceType) => {

    /* #debuger parameters 
console.log("log insert not Empty -->", dater, noter, serviceType)*/


    db.transaction(
        tx => {
            tx.executeSql('UPDATE Names SET dbdate=? , dbnotes=? , dbtype=?  WHERE track_id = 1 ', [dater, noter, serviceType],
                (txObj, resultSet) => console.log('db data res ------>', resultSet.dbnotes),
                (txObj, error) => console.log('Error insert', error));
            tx.executeSql('SELECT * FROM Names', [], (_, { rows }) => { rows._array.length > 1 ? console.log("rows length: ", rows._array.length) : null });
            update();


        });


}

enter image description here

1 Like

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.