Page 1 of 1

Update failed. Found 0 records.

Posted: Sun 22 May 2005 06:57
by OraDev
Hello

I would like to update only certain records in a table, I added a condition to my update statement, it's look like

UPDATE MyTable
SET
ST_NO = :ST_NO,
ST_NAME = :ST_NAME,
ST_NOTES = :ST_NOTES
WHERE
ST_NO = :OLD_ST_NO

It's work fine, if I add another condiditon to where clause like
And Posted = 0

I got this error
"Update failed. Found 0 records."

I use Data Aware controls


Thanks in advance

Posted: Mon 23 May 2005 13:38
by Alex
Please specify your ODAC version, and script to create your table, also include whole UPDATE SQL that you use.

Posted: Wed 25 May 2005 08:06
by OraDev
Hi Alex

table MyTable
ST_NO NUMBER
ST_NAME VARCHAR2(40)
ST_NOTES VARCHAR2(100)
P NUMBER(1)

the update work fine when I set it to
UPDATE MyTable
SET
ST_NO = :ST_NO,
ST_NAME = :ST_NAME,
ST_NOTES = :ST_NOTES
WHERE
ST_NO = :OLD_ST_NO

but it will gave that error when I just add p = 0

UPDATE MyTable
SET
ST_NO = :ST_NO,
ST_NAME = :ST_NAME,
ST_NOTES = :ST_NOTES
WHERE
ST_NO = :OLD_ST_NO
AND P = 0

I'm using Delphi 2005, Odac 5.50.1.18 29.04.05

what I'm trying to do, to enable editing for specific records(where p = 0) and make it read it only if p = 1

Posted: Fri 27 May 2005 09:53
by Alex
Do you set this Update SQL to TOraQuery.SQLUpdate property, if so then if you try to update records with P field not equal to 0 you will get your exception because updated record can't be updated. If you don't want to raise exception in case that record update failed then set DataSet.Options.StrictUpdate to false.