Page 1 of 1

Read only dataset, why?

Posted: Wed 22 Aug 2012 16:39
by swm4
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.

Re: Read only dataset, why?

Posted: Wed 22 Aug 2012 16:50
by stevel
I'm using UniDAC. On the UniStoredProc component there is a 'SetFieldsReadOnly' property. Have you checked this?

Re: Read only dataset, why?

Posted: Thu 23 Aug 2012 13:33
by AlexP
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).

Re: Read only dataset, why?

Posted: Tue 28 Aug 2012 19:28
by swm4
Thank you. That solved the problem.

Re: Read only dataset, why?

Posted: Wed 29 Aug 2012 09:08
by AlexP
hello,

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