This is a migrated thread and some comments may be shown as answers.

Opendatasource with related tables

3 Answers 97 Views
Databases and Data Types
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
juance
Top achievements
Rank 1
juance asked on 15 Apr 2009, 12:48 AM
I want to link the table territories (Northwindoa database) to a openaccessdatasource to add and modify records
the territories,RegionID field  disappears and is required for linking controls to edition or insertion
the list of fields in the openaccessdatasource are: TerritoryId, territorydescription, Region, Region.RegionID, and Region.RegionDescription.

But Territory.RegionID not exist

It is a mistake or am I doing something wrong

I want link the openaccessdatasource to radgrid

Thanks in advance



3 Answers, 1 is accepted

Sort by
0
Zoran
Telerik team
answered on 17 Apr 2009, 06:07 AM
Hello juance,

          The reason for the behavior you experience is that OpenAccess creates a reference as filed of the persistent classes for the relations between tables classes. For example the Territory table has a relation to the Region table. Hence, OpenAccess creates a Territory and Region classes and the Territory class has a reference field of type "Region".

         So, to access the RegionID field you use the following construction:  Territory.Region.RegionID. For insert statements though you should assign a Region object to the Territory like: territory.Region = myRegion. OpenAccess resolves the references in the lower layers and inserts the right values in the right collumns of the database tables.

If you need any further instructions please do not hesitate to contact us back.

Sincerely yours,
Zoran
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
juance
Top achievements
Rank 1
answered on 17 Apr 2009, 02:51 PM
I have not explained well

I have a radgrid linked to a openaccessdatasource with territory class
When I link controls in the editing template  the territory.RegionID field of the table does not appear
Therefore I can not insert or edit data
I see only a Field Region and that is not  upgradable
.
I do not want to use code behind
0
Zoran
Telerik team
answered on 21 Apr 2009, 04:09 PM
Hi juance,

OpenAccess is not able to perform such operation without the use of code-behind. The related "Region" object should be assigned to the new "Territory" instance in the "Inserting" event handler of the OpenAccessDataSource.

All the best,
Zoran
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
Databases and Data Types
Asked by
juance
Top achievements
Rank 1
Answers by
Zoran
Telerik team
juance
Top achievements
Rank 1
Share this question
or