# Mysql - updating multiple data

**URL:** <https://forum.xojo.com/t/mysql-updating-multiple-data/38857>\
**Category:** Databases\
**Created:** [July 25, 2017, 8:01am UTC](https://forum.xojo.com/t/mysql-updating-multiple-data/38857 "2017-07-25T08:01:59Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Arief\_Sarjono](https://forum.xojo.com/user_avatar/forum.xojo.com/arief_sarjono/32/692_2.png) [@Arief\_Sarjono](https://forum.xojo.com/u/Arief_Sarjono)\
**Post date:** [July 25, 2017, 8:01am UTC](https://forum.xojo.com/t/mysql-updating-multiple-data/38857/1 "2017-07-25T08:01:59Z")

</div>

Hi all,

I am trying to do updating multiple data from list box,  
in the sample its showing only how to update the single data using ID,

Listbox 1  
Apple 2  
orange 2

so I wanted to write in to database, inserting the new record if the item is not exist and update all the match item’s quantity.  
if its only calculating between list box, i can do it, but the problem is, how to update the database.

here’s the code

[code] Dim o, i as integer  
dim row as integer  
row =Listbox4.listcount-1  
dim the\_code as string  
dim bFound as boolean  
bFound = false  
For o = 0 to row  
the\_code = listbox4.cell(o,4)

```
For i = 0 To Customerslist1.ListCount - 1
  If Customerslist1.ListCount >0 then
    If Customerslist1.cell(i,2) = the_code then
      Customerslist1.cell(i,9)=str(val(Customerslist1.cell(i,9))+val(Listbox4.cell(o,8)))
      bFound = true
     Customerslist1.cell(i,12)=str(val(Customerslist1.cell(i,9))+val(Customerslist1.cell(i,10))+val(Customerslist1.cell(i,11)))
    End if
  end if
Next

```

Next[/code]

this code only change the value on the list box(customerslist1) based from Listbox4, not updating the database.

any help…?

sorry for my poor English.

Thanks  
Arief

---

<div class="post-metadata">

**Author:** ![DaveS](https://forum.xojo.com/letter_avatar_proxy/v4/letter/d/848f3c/32.png) [@DaveS](https://forum.xojo.com/u/DaveS)\
**Post date:** [July 25, 2017, 2:17pm UTC](https://forum.xojo.com/t/mysql-updating-multiple-data/38857/2 "2017-07-25T14:17:39Z")

</div>

Where is that code is a Database even mentioned?

---

<div class="post-metadata">

**Author:** ![anon20074439](https://forum.xojo.com/letter_avatar_proxy/v4/letter/a/ac8455/32.png) [@anon20074439](https://forum.xojo.com/u/anon20074439)\
**Post date:** [July 25, 2017, 2:59pm UTC](https://forum.xojo.com/t/mysql-updating-multiple-data/38857/3 "2017-07-25T14:59:13Z")

</div>

See the example included with Xojo

File-\>New Project-\>Examples-\>Database-\>SQLite-\>SQLiteExample

All the code you need is in there.

---

<div class="post-metadata">

**Author:** ![system](https://forum.xojo.com/uploads/default/original/1X/455b4dcc0e61630e9f81940004ddffa49c432a46.png) [@system](https://forum.xojo.com/u/system)\
**Post date:** [October 29, 2020, 6:51pm UTC](https://forum.xojo.com/t/mysql-updating-multiple-data/38857/4 "2020-10-29T18:51:29Z")

</div>


