Update failed. Found 0 records.

Discussion of open issues, suggestions and bugs regarding ODAC (Oracle Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
OraDev

Update failed. Found 0 records.

Post by OraDev » Sun 22 May 2005 06:57

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

Alex
Posts: 655
Joined: Mon 08 Nov 2004 08:39

Post by Alex » Mon 23 May 2005 13:38

Please specify your ODAC version, and script to create your table, also include whole UPDATE SQL that you use.

OraDev

Post by OraDev » Wed 25 May 2005 08:06

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

Alex
Posts: 655
Joined: Mon 08 Nov 2004 08:39

Post by Alex » Fri 27 May 2005 09:53

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.

Post Reply