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
Update failed. Found 0 records.
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
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
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.