Page 1 of 1

Cannot modify a read-only dataset.

Posted: Fri 14 Jan 2011 10:50
by Fastex
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 =)

Posted: Fri 14 Jan 2011 12:27
by AlexP
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.

Posted: Sun 16 Jan 2011 09:54
by Fastex
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... :(

Posted: Sun 16 Jan 2011 17:43
by Fastex
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

Posted: Mon 17 Jan 2011 08:55
by Fastex
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

Posted: Mon 17 Jan 2011 10:00
by AlexP
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:

Posted: Tue 18 Jan 2011 11:18
by Fastex
I found another case when this error appears. If I use UniTable->FieldValues["..."]=... , and the I use method Delete(), this error appears

Posted: Tue 18 Jan 2011 13:22
by AlexP
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.