MySQL Update request , need explanations

Hi all.

Using an old Xojo version before, today i must use DatabaseRecord for be able to use some row.
Ok so, now this is almost the same thing like PHP.
Ok, i have understood how to insert a record in my database.

But before, i used a simple MySQL request like this for making update:

r = db.SQLSelect("UPDATE  `guest` SET  `first_name` = '"+Prenom.Text+"' , .../....WHERE `id` = '"+Session.id_guest+"'; )

Because sure, i need to making update only for the record id. “Update… Where id = x”

I don’t understand how to do it?
You talking about r.update, ok but how to update only the record id?

As db.InsertRecord(table,row) is perfect to making insert.
i expected to have this kind of tool : db.Update(table, row, condition).

Today, this way doesn’t work because it refuses any webtextfield values inside the request.
This way was simple and efficient.

Could you explain me how it should work now?

I’m not quite clear on what it is you need to do ?
Have you retrieved a recordset and just want to update the ID of one of the records in the recordset ?

You can use

db.SQLExecute("UPDATE  `guest` SET  `first_name` = '"+Prenom.Text+"' , .../....WHERE `id` = '"+Session.id_guest+"'; )

Or load the record in a RecordSet and then edit… something like

Dim r As Recordset = db.SQLSelect(myQuery)

r.field("myFieldName").StringValue = "myNewValue"


Use postgresq
It should not be very different from Mysql.

dim p As PostgreSQLPreparedStatement = app.pasaDB.Prepare(“UPDATE periodos SET interes=$1 WHERE yy = $2 AND mm= $3”)
p.SQLExecute (interes.Text, tyy, tmm)

if app.pasaDB.Error then
terrmsg = “Error periodos” + app.pasaDB.ErrorMessage
end if

Ok Great,
Thanks for these explanations.
I see how to do it as well.

Thanks at all.