Read only dataset, why?

Discussion of open issues, suggestions and bugs regarding UniDAC (Universal Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
swm4
Posts: 8
Joined: Wed 17 Dec 2008 22:48

Read only dataset, why?

Post by swm4 » Wed 22 Aug 2012 16:39

Using UniDAC 4.1.4 with an Oracle database. I recently switched out the ODAC components to the UniDAC so I know this worked with ODAC. I'm trying to figure out why it won't work with UniDAC.

In a TUniQuery when I try to edit a field value, I get an exception saying "Cannot modify a read-only dataset" while I call DataSet.Edit. There are no custom fields and no persistent fields. I have set up SQLUpdate to edit a specific row based on a key value. Here's the query:

Code: Select all

SELECT * FROM
(SELECT *
   FROM current_context
  WHERE contract_number IS NOT NULL
    AND contract_signed IS NULL

UNION
   
SELECT *
  FROM future_context   
 WHERE contract_number IS NOT NULL
   AND contract_signed IS NULL

UNION 

SELECT *
  FROM context
 WHERE effective_date > SYSDATE
  AND contract_number IS NOT NULL
  AND contract_signed IS NULL
)   
ORDER BY contract_number DESC
If I remove the outer select and order by and use the following query, there is no exception and I can edit the data just fine.:

Code: Select all

SELECT *
   FROM current_context
  WHERE contract_number IS NOT NULL
    AND contract_signed IS NULL

UNION
   
SELECT *
  FROM future_context   
 WHERE contract_number IS NOT NULL
   AND contract_signed IS NULL

UNION 

SELECT *
  FROM context
 WHERE effective_date > SYSDATE
  AND contract_number IS NOT NULL
  AND contract_signed IS NULL
Why would the second query work but not the second query? It works fine in ODAC but not UniDAC.

stevel
Posts: 125
Joined: Tue 02 Nov 2010 19:01

Re: Read only dataset, why?

Post by stevel » Wed 22 Aug 2012 16:50

I'm using UniDAC. On the UniStoredProc component there is a 'SetFieldsReadOnly' property. Have you checked this?

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: Read only dataset, why?

Post by AlexP » Thu 23 Aug 2012 13:33

hello,

The same settings of UniDAC and separate products (ODAC particularly) can have different values. Therefore, to solve the problem, in UniDAC you should set the UniQuery1.Options.SetFieldsReadOnly property to False (this option is set to True in UniDAC by default, in ODAC - False).

swm4
Posts: 8
Joined: Wed 17 Dec 2008 22:48

Re: Read only dataset, why?

Post by swm4 » Tue 28 Aug 2012 19:28

Thank you. That solved the problem.

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: Read only dataset, why?

Post by AlexP » Wed 29 Aug 2012 09:08

hello,

Glad to see that the problem was solved. If you have any other questions, feel free to contact us.

Post Reply