Other ways to save listbox


Just wondering if there is another way to save listbox item into a database.
The database is populated on a listbox. If I made some changes in that listbox, how to update the database.?
so far what I’m doin is, just drop the table then save it all the listbox item again into the database. This is working, but way to slow.
The item that I had in the database is only 2000 items, but it takes 30 second to process.

Is there any other faster way?



If i follow you correctly, you’re deleting the table entirely, re-creating the table and saving back the items from the ListBox. I haven’t got Xojo in front of me, so it’s from memory I’ve drafted the below code. In essence, after you complete an edit for a row, then add the below code to save only the row edited. Check the LR it should clarify the below code further. There are other ways to achieve this but this is for starters.

ps. The code above, effectively is a template, substitute your values.

When you retrieve each row, put the primary key value into the RowTag property:

ListBox1.AddRow rs.field("name").stringvalue
ListBox1.RowTag(ListBox1.LastIndex) = rs.field("primary_key").value

That way, it’s hidden from the user but easily accessible.