Wrong UpdatingTable - table X is unknown.
Posted: Thu 07 Oct 2010 04:47
Hi,
Delphi RAD 2010, UniDAC 3.00.0.10, PostgreSQL.
Objective: updating one of the tables in a multi table query (unfortunately PostgreSQL doesn't support updatable views without going through the trouble of creating the view first and defining rules):
Methods: using the UpdateSQL and UpdatingTable properties of TUniQuery.
I have the following TUniQuery:
SELECT DISTINCT
"tTable1"."iTable1ID" AS "iTable1ID",
"tTable1"."bCompleted" AS "bCompleted",
"tTable1"."dDate" AS "dDate",
"tTable2"."sDescription" AS sTable2,
"tTable3"."sDescription" AS sTable3,
"tTable4"."sDescription" AS sTable4
FROM ((("tTable1" INNER JOIN "tTable5" ON "tTable1"."iTable5ID"="tTable5"."iTable5ID") LEFT JOIN "tTable3" ON "tTable1"."iTable3ID"="tTable3"."iTable3ID") INNER JOIN "tTable2" ON "tTable1"."iTable2ID"="tTable2"."iTable2ID") INNER JOIN "tTable4" ON "tTable1"."iTable4ID"="tTable4"."iTable4ID"
WHERE (("bCompleted"=False) AND ("tTable1"."dDate">='20071001') AND ("tTable1"."dDate"<='20101031') AND ("tTable3"."sDescription" Is Null) AND "tTable2"."sDescription" IN ('Debit Request'))
ORDER BY "tTable5"."iTable5ID"
when I set UpdatingTable to "tTable1" I get the error message:
Wrong UpdatingTable - table "tTable1" is unknown. I've tried this with QuoteNames True and False, either way I'm getting the error.
I've also tried using the SQLUpdate property of the TUniQuery to:
UPDATE "tTable1"
SET "dDate" = :dDate, "bCompleted" = :bCompleted
WHERE "iTable1ID" = :iTable1ID
The following code:
with Table1.FieldByName ('bCompleted') do Value := not Value;
doesn't trigger the UpdateSQL statement (I set Debug to True and it doesn't show a debug pop up dialoge) but generates the error:
Field "bCompleted" cannot be modified.
kind regards,
Jan
Delphi RAD 2010, UniDAC 3.00.0.10, PostgreSQL.
Objective: updating one of the tables in a multi table query (unfortunately PostgreSQL doesn't support updatable views without going through the trouble of creating the view first and defining rules):
Methods: using the UpdateSQL and UpdatingTable properties of TUniQuery.
I have the following TUniQuery:
SELECT DISTINCT
"tTable1"."iTable1ID" AS "iTable1ID",
"tTable1"."bCompleted" AS "bCompleted",
"tTable1"."dDate" AS "dDate",
"tTable2"."sDescription" AS sTable2,
"tTable3"."sDescription" AS sTable3,
"tTable4"."sDescription" AS sTable4
FROM ((("tTable1" INNER JOIN "tTable5" ON "tTable1"."iTable5ID"="tTable5"."iTable5ID") LEFT JOIN "tTable3" ON "tTable1"."iTable3ID"="tTable3"."iTable3ID") INNER JOIN "tTable2" ON "tTable1"."iTable2ID"="tTable2"."iTable2ID") INNER JOIN "tTable4" ON "tTable1"."iTable4ID"="tTable4"."iTable4ID"
WHERE (("bCompleted"=False) AND ("tTable1"."dDate">='20071001') AND ("tTable1"."dDate"<='20101031') AND ("tTable3"."sDescription" Is Null) AND "tTable2"."sDescription" IN ('Debit Request'))
ORDER BY "tTable5"."iTable5ID"
when I set UpdatingTable to "tTable1" I get the error message:
Wrong UpdatingTable - table "tTable1" is unknown. I've tried this with QuoteNames True and False, either way I'm getting the error.
I've also tried using the SQLUpdate property of the TUniQuery to:
UPDATE "tTable1"
SET "dDate" = :dDate, "bCompleted" = :bCompleted
WHERE "iTable1ID" = :iTable1ID
The following code:
with Table1.FieldByName ('bCompleted') do Value := not Value;
doesn't trigger the UpdateSQL statement (I set Debug to True and it doesn't show a debug pop up dialoge) but generates the error:
Field "bCompleted" cannot be modified.
kind regards,
Jan