<?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 assigning guid value to guid field in .net c# in ArcObjects SDK Questions</title>
    <link>https://community.esri.com/t5/arcobjects-sdk-questions/assigning-guid-value-to-guid-field-in-net-c/m-p/569713#M15362</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;This seems to be a trivial thing: we want to use a GUID field (not GlobalID) onto a feature class to correlate each feature with an entity in another system. We declared the type as GUID in ArcCatalog, all other fields are just fine for writing, but when we try to write to a feature using &lt;/SPAN&gt;&lt;STRONG&gt;IFeature.set_Value(index,value)&lt;/STRONG&gt;&lt;SPAN&gt;, we get the following errors:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;- if we use a value of type System.Guid directly, we get: "Th&lt;/SPAN&gt;&lt;SPAN style="font-style:italic;"&gt;e value type is incompatible with the field type&lt;/SPAN&gt;&lt;SPAN&gt;."&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;- if we use System.Guid.ToString("N"), we get:"&lt;/SPAN&gt;&lt;SPAN style="font-style:italic;"&gt;A general error when something is wrong with a Field&lt;/SPAN&gt;&lt;SPAN&gt;" (yeah, thanks for that one esri!)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Other details: Using ArcGIS 10.0 SP2 (build 3200) against a SQL Express personnal SDE. The SQL Type of the field is Uniqueidentifier.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks in advance for any pointers.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Regards,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Eric.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 05 Aug 2011 01:17:14 GMT</pubDate>
    <dc:creator>ericliprandi</dc:creator>
    <dc:date>2011-08-05T01:17:14Z</dc:date>
    <item>
      <title>assigning guid value to guid field in .net c#</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/assigning-guid-value-to-guid-field-in-net-c/m-p/569713#M15362</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;This seems to be a trivial thing: we want to use a GUID field (not GlobalID) onto a feature class to correlate each feature with an entity in another system. We declared the type as GUID in ArcCatalog, all other fields are just fine for writing, but when we try to write to a feature using &lt;/SPAN&gt;&lt;STRONG&gt;IFeature.set_Value(index,value)&lt;/STRONG&gt;&lt;SPAN&gt;, we get the following errors:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;- if we use a value of type System.Guid directly, we get: "Th&lt;/SPAN&gt;&lt;SPAN style="font-style:italic;"&gt;e value type is incompatible with the field type&lt;/SPAN&gt;&lt;SPAN&gt;."&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;- if we use System.Guid.ToString("N"), we get:"&lt;/SPAN&gt;&lt;SPAN style="font-style:italic;"&gt;A general error when something is wrong with a Field&lt;/SPAN&gt;&lt;SPAN&gt;" (yeah, thanks for that one esri!)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Other details: Using ArcGIS 10.0 SP2 (build 3200) against a SQL Express personnal SDE. The SQL Type of the field is Uniqueidentifier.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks in advance for any pointers.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Regards,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Eric.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 05 Aug 2011 01:17:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/assigning-guid-value-to-guid-field-in-net-c/m-p/569713#M15362</guid>
      <dc:creator>ericliprandi</dc:creator>
      <dc:date>2011-08-05T01:17:14Z</dc:date>
    </item>
    <item>
      <title>Re: assigning guid value to guid field in .net c#</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/assigning-guid-value-to-guid-field-in-net-c/m-p/569714#M15363</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Make sure you're formatting the value so that the database can recognize it as a Guid.&amp;nbsp; Here's a method we use to convert the Guid object to a value that can be written to the database.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Public Shared Function GuidToDatabase(ByVal value As System.Guid) As Object
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; If value = System.Guid.Empty Then
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Return DBNull.Value
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Else
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Return "{" &amp;amp; value.ToString &amp;amp; "}"
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; End If
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; End Function
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 00:31:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/assigning-guid-value-to-guid-field-in-net-c/m-p/569714#M15363</guid>
      <dc:creator>NeilClemmons</dc:creator>
      <dc:date>2021-12-12T00:31:39Z</dc:date>
    </item>
    <item>
      <title>Re: assigning guid value to guid field in .net c#</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/assigning-guid-value-to-guid-field-in-net-c/m-p/569715#M15364</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Neil,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks for your reply. We actually found the answer a few minutes after this post. I just wish esri would document that somewhere. Anyway, for SQL Server back-end, it seems that the "B" formatting of the guid will work (based on &lt;/SPAN&gt;&lt;A href="http://msdn.microsoft.com/en-us/library/97af8hh4.aspx"&gt;msdn documentation&lt;/A&gt;&lt;SPAN&gt;).&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;We haven't tried against Oracle yet, but I am really hoping that esri is taking care of abstracting the database from us... it would be a shame if we had to care about what RDBMS is underneath and format our data differently. I'll post an update once we test against Oracle.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Regards,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Eric.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 05 Aug 2011 14:33:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/assigning-guid-value-to-guid-field-in-net-c/m-p/569715#M15364</guid>
      <dc:creator>ericliprandi</dc:creator>
      <dc:date>2011-08-05T14:33:10Z</dc:date>
    </item>
  </channel>
</rss>

