Updating A SQLite Database In iOS

[quote=211215:@Paul Lefebvre]You’ll have to use an UPDATE statement. From the EE example (Customer.Save method):

[code] Dim sql As Text
sql = "UPDATE Customers SET FirstName = ?1, LastName = ?2, " + _
"Address = ?3, City = ?4, State = ?5, Zip = ?6, Phone = ?7, " + _
“Email = ?8, Taxable = ?9 WHERE ID = ?10”

// Pass in values after sql instead of doing string replacement
App.EEDB.SQLExecute(sql, FirstName, LastName, Address, City, State, _
Zip, Phone, Email, Taxable, ID)[/code]

Just use your table and column names and pass in the values you want as part of the SQLExecute method.[/quote]

Is something like the old RecordSet based way of updating records ever going to come to the new framework? Like this:

<https://xojo.com/issue/37342>

That way of doing things has been helpful to us with our desktop app, and it would be good to know whether we could do anything similar in the new framework or whether we should just bite the bullet and write our own low-level methods to achieve something similar so that we can share as much business logic as possible between our desktop and iOS projects.

Hi Tom. I think the definitive answer is bite the bullet. The new framework is where it is going and I think we just have to adapt to it. That is what I had to do above. Instead of trying to use the actual recordset to bookmark the records, I had to add another table that would act as the navigation control through the records, and bypass the reloading the recordset all together. Its not pretty but it works.

[quote=211453:@Simon Berridge]I don’t see how this code would run at all:

sql = "UPDATE Table1 SET FirstName = ?1, LastName = ?2, WHERE id = ?3"
The issue is there is a comma after parameter 2. The code should be:

sql = "UPDATE Table1 SET FirstName = ?1, LastName = ?2 WHERE id = ?3" [/quote]

Thanks Simon. That was indeed the problem.

Thanks, James. I’m working under the assumption that this is the case, but just wanted to try and get a response to my Feedback case from Xojo as to whether it’s just that they haven’t got around to adding that functionality to the new framework, or whether they consider the database part to be “done”.