Oracle+DAO Interesting Problem in UPDATES 
Author Message
 Oracle+DAO Interesting Problem in UPDATES


I have run into a problem wtih an application that I have been working on
for sometime.

I am using VC to connect to an Oracle backend (Driver Version 2.574.4202.00)
using the DAO MFC Classes thru ODBC. Connecting to the DB and use of SELECT
quieris is working fine.

When I tried to use the UPDATE query (Using
CDaoDatabase.Execute("UPDATE...")) on a view of a table (say TABLE_X) then
it gives me the following error:

>> "Operation must use an updatable Query".<<

Baffled by this error, I replaced the code to use a CDaoQueryDef object, and
checked its TYPE property, after I set the SQL string. It reported a Select
Query (dbQSelect) even tho my actual Query was:

UPDATE view_of_table_x SET field_a='55' where field_a ='5';

Also, interestingly, the same query seems to work just perfectly when I
execute it on the actual table as in

UPDATE table_x SET field_a='55' where field_a ='5';

I guessed that there may be some problems about Updating the view... so I
created a new table: TABLE_Y as follows

CREATE table_y AS SELECT * FROM table_x;

The UPDATE Query again failed on table_y giving the same error >> "Operation
must use an updatable Query".<<

What is more baffling is that when I try to execute all these Queries at
Oracle's SQL Plus Prompt, they work fine. I also used an ODBC Explorer
utility to execute these queries, and there also they seem to work well.

I dont understand why does MFC think that I am giving a SELECT Query where I
am actually using an UPDATE Query?
Any help/pointers/guidance would be much appreciated.

Thanks much!
- Harsh

Thu, 31 Jul 2003 10:22:17 GMT  
 [ 1 post ] 

 Relevant Pages 

1. Oracle Problem With DAO

2. Interesting Problem Needs Interesting Solution. :)

3. DAO update problem

4. DAO update problem

5. Q: Oracle 8 with DAO/OLE-DB

6. Oracle - DAO or ODBC?

7. DAO support Oracle?

8. Updating Oracle RAW field with IADORecordBinding and adBinary

9. updating long raw data in oracle

10. DAO and Oracle

11. Oracle ODBC-Driver doesn't update data

12. use the ExecuteSQL function of CDatabase MFC class to update a table in Oracle database


Powered by phpBB® Forum Software