Page 1 of 1

UniTable1: Cannot modify a read-only dataset

Posted: Wed 04 May 2011 09:41
by Fastex
Hello,

I work in C++ Builder 2010 with MS Access DB. I use ONE UniTable for output 10 tables. If I write queries like "select * from table" or "select f1, f2, f3 from table" it works, but if I write queries like: "select f1 AS [name]... from table" then it does not work. If I add construction "AS [....]" in a queries, I can see contents in the grid, but if I want to delete or insert any records, I get the error: "Cannot modify a read-only dataset".

I use methods UniTable->Delete(); and UniTable->Insert();

When I open grid I do it as:

Code: Select all

DataModule4->UniTable1->Active=false;
DataModule4->UniTable1->TableName="Tipy_Bortov";
DataModule4->UniTable1->SQL->Text="SELECT Tip_Borta AS [Тип ВС] FROM Tipy_Bortov";
DataModule4->UniTable1->Active=true;

I need my own names in grid's headers.

Can I add fields in UniTable by program code like on a form ?

Image
Image
Image
Image

Help me please. A lot of thanks!

Posted: Wed 04 May 2011 14:09
by AlexP
Hello,

Thank you for the information.
We have reproduced the problem.
We will notify you as soon as we fix the problem.

You can add existing fields, for example, like :

Code: Select all

......

private: // User declarations
 TIntegerField *FIntField;
 TWideStringField *FStrField;
........

UniTable1->Active = False;
UniTable1->SQL->Text = "SELECT ID_Tipa_Borta, Tip_Borta FROM Tipy_Bortov";
FIntField = new TIntegerField(NULL);
FIntField->FieldName = "ID_Tipa_Borta";
FIntField->DisplayLabel = "Идентификатор";
FIntField->DataSet = UniTable1;

FStrField = new TWideStringField(NULL);
FStrField->FieldName = "Tip_Borta";
FStrField->DisplayLabel = "Тип ВС";
FStrField->DataSet = UniTable1;

UniTable1->Active = True;