Trouble with SQLUpdate
Trouble with SQLUpdate
Hi!
I'm using TMyQuery to work with database.
Now i want to update database entries using the SQLPUpdate Method.
Code i use:
With MYQuery Do
Begin
Try
SQLUpdate.Add('UPDATE Table SET Name = 'Test'
WHERE Nr =1');
ApplyUdates
except
RestoreUpdates;
Raise;
end;
CommitUpdates;
End;.......................................
I'm just a beginner.... What is wrong??? Or is there a better way??
Thank's a lot!!!!!!!
The easiest way is to execute the query
> I'm just a beginner...
Ok, SQLUpdate and ApplyUpdates unlikely will be necessary for you at the nearest time.
[/code]
Code: Select all
MyQuery.SQL.Text := 'SELECT * FROM ...';
MyQuery.Open;
MyQuery.Edit;
MyQuery.Fields[].As... := ...
MyQuery.Post;
Ok, SQLUpdate and ApplyUpdates unlikely will be necessary for you at the nearest time.
[/code]