SehnOken
User
 Fresh Boarder
| Posts: 3 |   | Karma: 0 |
|
How to Update a record
|
|
Posted: 2003/02/05 15:28 |
|
|
|
|
Hi, Im usign TOCI8 components. It's kool. But i have a problem updating records in Oracle. Mode 1: DBUpdate.SQLUpdate.Text := 'UPDATE COLORS SET ICON_COLOR=''icon1'', ICONO_ACT=''icon2'' WHERE COLOR=''color1'''; DBUpdate.ExecSQL(skUpdate); DB1.Commit;
This mode works very well. But I dont want to use Update SQL Queries. I need to edit field by field, such as this:
with DBQuery do begin SQL.Text := 'SELECT * FROM COLORS'; Open; Locate('COLOR','color1',[loCaseInsensitive]); Edit; FieldByName('ICON_COLOR').AsString := 'icon1'; FieldByName('ICON_ACT').AsString := 'icon2'; Post; DB1.Commit; end;
It does not work, because there apears an error:
Can't execute query. Undefined key fields.
And that's the problem! How can I define the Key Fields??? The Primari Key field is the column COLOR, and the oracle contraint is PK_COLORS.
What i need to do to work fine??? Is there another way to update a record better than those???
Thaks for advanced!
|
|