Cannot modify a read-only dataset.

Discussion of open issues, suggestions and bugs regarding UniDAC (Universal Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
Fastex
Posts: 15
Joined: Wed 20 Oct 2010 08:52

Cannot modify a read-only dataset.

Post by Fastex » Fri 14 Jan 2011 10:50

I write in C++ Builder 2010, and I have some problem with UniTable.
I Use Access DB. I can connect to Db and I can insert something into db. But if I want to delete anything from db by method "Delete()", Builder writes the error "Cannot modify a read-only dataset." all "read-only" properties is FALSE any where.

Who does know, help me please =)

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

Post by AlexP » Fri 14 Jan 2011 12:27

Hello,

I could not reproduce the problem.
Please send a complete small sample to alexp*devart*com to demonstrate it including a database.
Also please specify the exact version of UniDAC and MS Access.

Fastex
Posts: 15
Joined: Wed 20 Oct 2010 08:52

Post by Fastex » Sun 16 Jan 2011 09:54

I'm sorry. I have tried to do it on the new project and there it works. But I don't know why it isn't working in my old project... :(

Fastex
Posts: 15
Joined: Wed 20 Oct 2010 08:52

Post by Fastex » Sun 16 Jan 2011 17:43

I have found the place where the error appears. When I write flolow code:

Code: Select all

UniTable1->Active=false;
UniTable1->TableName="TypesOfBoards";
[u]UniTable1->SQL->Text="Select ID_AC, NameOfAC as [Типы ВС] From TypesOfBoards";[/u]
UniTable1->Active=true;
UniDataSource1->DataSet=DataModule4->UniTable1;
after string, UniTable1->SQL->Text="Select ID_AC, NameOfAC as [Типы ВС] From TypesOfBoards";, where I edit SQL text, this error are appearing. If do not edit this string, then it's works.[/i]

I made this query because I need my own names of fields in DBGreed

Fastex
Posts: 15
Joined: Wed 20 Oct 2010 08:52

Post by Fastex » Mon 17 Jan 2011 08:55

Fastex wrote:I have found the place where the error appears. When I write flolow code:

Code: Select all

UniTable1->Active=false;
UniTable1->TableName="TypesOfBoards";
[u]UniTable1->SQL->Text="Select ID_AC, NameOfAC as [Типы ВС] From TypesOfBoards";[/u]
UniTable1->Active=true;
UniDataSource1->DataSet=DataModule4->UniTable1;
after string, UniTable1->SQL->Text="Select ID_AC, NameOfAC as [Типы ВС] From TypesOfBoards";, where I edit SQL text, this error are appearing. If do not edit this string, then it's works.[/i]

I made this query because I need my own names of fields in DBGreed
===============================================
I have sloved the problem by DBGrid->Columns->Items[]->Title->Caption="";

But I wont to know how does it work

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

Post by AlexP » Mon 17 Jan 2011 10:00

Hello,

To use your own names of the DBGrid columns you can change the Title.Caption properties in DBrid, or you can use the TUniQuery component instead of TUniTable like:

Fastex
Posts: 15
Joined: Wed 20 Oct 2010 08:52

Post by Fastex » Tue 18 Jan 2011 11:18

I found another case when this error appears. If I use UniTable->FieldValues["..."]=... , and the I use method Delete(), this error appears

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

Post by AlexP » Tue 18 Jan 2011 13:22

Hello,


If you have added any fields into TUniTable and after that you have changed the set of fields, you will get the error. So if you need to change the set of fields, you should clear the set of fields in TUniTable like UniTable1->Fields->Clear(), or if you need to change only the names of columns in DBGrid, you should change the Title.Caption properties without changing the SQL statement like DBGrid1->Columns[0]->Title->Caption := "new caption".
So as I have written you earlier, to use your own SQL statement you should use TUniQuery instead of TUniTable.

Post Reply