Topic: Having a problem with an UPDATE statement
I would like some help on formatting a SQLExecute statement. I've tried all sorts of variations and this particular field never gets filled no matter what I try I get a SQL error.
My current code is as below and this throws a 'constraint error', however reworking this gives me different errors.
The current error is UPDATE orders SET id_productSupplier = "x" WHERE id = "xx" (x and xx equals a ID number).
procedure frmOrderEntry_btnOrder_OnAfterClick (Sender: TObject);
var
idx, dbx :string;
begin
{last database entry ID}
dbx := intToStr(Last_Insert_id);
{ID of item in productsupplier}
idx := intToStr(frmOrderEntry.grdOrder.dbItemID);
showmessage('dbx '+ dbx + ' idx '+ idx);
//extract productsupplier ID and insert into orders table
sqlexecute('UPDATE orders SET id_productSupplier = "'+dbx+'" WHERE id = "'+idx+'"');
end;
idx and dbx do contain the correct record numbers.
Manually entering the SQL into SQL studio works, but then I'm not using variables in that instance.
Please help, otherwise the cat is only going to have 6 lives left, as his assistance has been of no help at all.