Select to view content in your preferred language

How to insert row into related table

1289
4
09-14-2010 02:24 AM
Udaya_BhaskerCheerala
Emerging Contributor
Hi,
I wanted to insert rows into related table while creating feature. Iam doing this using Class Extension (IObjectClass Oncreate event). Iam able to get related tables of current feature class. but Iam not able to insert row into related tables while inserting records into related table Iam getting 'Objects in this class cannot be updaed outside an edit session'.

Iam trying to insert row into related table using below code

IRow pRow = PTable.CreateRow();
pRow.set_Value(1,10);
pRow.Store();

can anybody help me how to solve this issue.

Thanks,
Uday
0 Kudos
4 Replies
NeilClemmons
Honored Contributor
You'll need to start an edit session on the workspace that contains the related table(s).
0 Kudos
Udaya_BhaskerCheerala
Emerging Contributor
You'll need to start an edit session on the workspace that contains the related table(s).


Hi Neil,

I have tried the above, but still Iam not able to insert.

Thanks,
Uday
0 Kudos
vincentLahaye
Emerging Contributor
Hi,

do you have same error! 

if not,your problem is maybe in your Create event of your extensionclass.  When "Store" is called Create event is fire.

If your Create event is not fire, be sure your related table got same EXTCLSID of your FeatureClass, with this Create event will be call.
0 Kudos
Udaya_BhaskerCheerala
Emerging Contributor
Hi,
My problem got solved. After "Store" I have added below line.

pRelClass.CreateRelationship(createdObject, relatedObject);

Thanks,
Uday



Hi,

do you have same error! 

if not,your problem is maybe in your Create event of your extensionclass.  When "Store" is called Create event is fire.

If your Create event is not fire, be sure your related table got same EXTCLSID of your FeatureClass, with this Create event will be call.
0 Kudos