<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic GDB CreateRelationship gives Read Only error in ArcObjects SDK Questions</title>
    <link>https://community.esri.com/t5/arcobjects-sdk-questions/gdb-createrelationship-gives-read-only-error/m-p/571232#M15404</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I have a GDB with a table and a feature class in a many-to-many relationship, using a relationship class.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;With ArcObjects 10.0.0 (using c#) I am using GetRow(OID) and GetFeature(OID) to get the two records to be linked, and then calling CreateRelationship(myFeatureClass, myRow) to create the relationship.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;
IRelationshipClass targetRelationshipClass = targetFeatureWorkspace.OpenRelationshipClass("myRelationshipClass");
IFeatureClass targetOriginFC = targetFeatureWorkspace.OpenFeatureClass(targetRelationshipClass.OriginClass.AliasName);
ITable targetDestinationTable = targetFeatureWorkspace.OpenTable(targetRelationshipClass.DestinationClass.AliasName);
while (...)
{
&amp;nbsp;&amp;nbsp;&amp;nbsp; //use lookup table to get the two oids to be linked.
&amp;nbsp;&amp;nbsp;&amp;nbsp; int oid1 = ...
&amp;nbsp;&amp;nbsp;&amp;nbsp; int oid2 = ...

&amp;nbsp;&amp;nbsp;&amp;nbsp; IFeature target_origin_row = targetOriginFC.GetFeature(oid1);
&amp;nbsp;&amp;nbsp;&amp;nbsp; IRow target_dest_row = targetDestinationTable.GetRow(oid2);
&amp;nbsp;&amp;nbsp;&amp;nbsp; targetRelationshipClass.CreateRelationship((IObject)target_origin_row, (IObject)target_dest_row);
}&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;However I am getting the following error:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;Workspace or data source is read only. [The C:\Temp\myGdb.gdb workspace is read only.]&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This only happens after about 1000-1200 calls to CreateRelationship.&amp;nbsp; If I force it to continue it will go for another 800-1000 more.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I am having difficulty finding any way to set the workspace in data "loading" mode or even use transactions, which I could do in 9.2 with the Java api, which solved many problems I had when doing bulk loading.&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Is there another wrapper or better way of using ArcObjects for .net when reading/writing to GDBs?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;thanks&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 11 Jan 2012 21:08:52 GMT</pubDate>
    <dc:creator>MattPratap</dc:creator>
    <dc:date>2012-01-11T21:08:52Z</dc:date>
    <item>
      <title>GDB CreateRelationship gives Read Only error</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/gdb-createrelationship-gives-read-only-error/m-p/571232#M15404</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I have a GDB with a table and a feature class in a many-to-many relationship, using a relationship class.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;With ArcObjects 10.0.0 (using c#) I am using GetRow(OID) and GetFeature(OID) to get the two records to be linked, and then calling CreateRelationship(myFeatureClass, myRow) to create the relationship.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;
IRelationshipClass targetRelationshipClass = targetFeatureWorkspace.OpenRelationshipClass("myRelationshipClass");
IFeatureClass targetOriginFC = targetFeatureWorkspace.OpenFeatureClass(targetRelationshipClass.OriginClass.AliasName);
ITable targetDestinationTable = targetFeatureWorkspace.OpenTable(targetRelationshipClass.DestinationClass.AliasName);
while (...)
{
&amp;nbsp;&amp;nbsp;&amp;nbsp; //use lookup table to get the two oids to be linked.
&amp;nbsp;&amp;nbsp;&amp;nbsp; int oid1 = ...
&amp;nbsp;&amp;nbsp;&amp;nbsp; int oid2 = ...

&amp;nbsp;&amp;nbsp;&amp;nbsp; IFeature target_origin_row = targetOriginFC.GetFeature(oid1);
&amp;nbsp;&amp;nbsp;&amp;nbsp; IRow target_dest_row = targetDestinationTable.GetRow(oid2);
&amp;nbsp;&amp;nbsp;&amp;nbsp; targetRelationshipClass.CreateRelationship((IObject)target_origin_row, (IObject)target_dest_row);
}&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;However I am getting the following error:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;Workspace or data source is read only. [The C:\Temp\myGdb.gdb workspace is read only.]&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This only happens after about 1000-1200 calls to CreateRelationship.&amp;nbsp; If I force it to continue it will go for another 800-1000 more.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I am having difficulty finding any way to set the workspace in data "loading" mode or even use transactions, which I could do in 9.2 with the Java api, which solved many problems I had when doing bulk loading.&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Is there another wrapper or better way of using ArcObjects for .net when reading/writing to GDBs?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;thanks&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Jan 2012 21:08:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/gdb-createrelationship-gives-read-only-error/m-p/571232#M15404</guid>
      <dc:creator>MattPratap</dc:creator>
      <dc:date>2012-01-11T21:08:52Z</dc:date>
    </item>
  </channel>
</rss>

