<?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 Add records to SQL from VB.NET in Developers Questions</title>
    <link>https://community.esri.com/t5/developers-questions/add-records-to-sql-from-vb-net/m-p/800706#M5351</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have a requirement to show routes from optimized routing. I have the routing complete and working and now I want to add the route to a map. I added to stops to maps by using the rest add feature call to the server. No problem with 30+ stops. The routes have hundreds of segments in the returned path. I need to show the direction of the paths with arrows at the end. I'm not going to write hundreds of segments to a rest endpoint for a couple dozen routes. I want to add the segments to a SQL database. I've been trying everything and I can add, update and delete as expected but when I try to calculate the SHAPE I get the following error that I can't find anything about.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;The UPDATE statement conflicted with the CHECK constraint "g90_ck". The conflict occurred in database "PSLGIS2", table "dbo.BLDG_RTE_STOPS", column 'SHAPE'.‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The sql statement I am sending is&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;INSERT&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;INTO&lt;/SPAN&gt; BLDG_RTE_STOPS &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;objectid&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; inspID&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; stopOrder&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;inputOrder&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; address&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; x&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; y&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; SHAPE&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;VALUES&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;3&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;208&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;1&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;2&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'123 sw psl blvd'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;-&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;8943761.976904802&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;3157847.4254109007&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;&lt;SPAN class="keyword token"&gt;geometry&lt;/SPAN&gt;::STPointFromText&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'POINT(-8943761.97 3157847.42)'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;3587&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I can add the attributes and create a new record without issue. I try to run an UPDATE bldg_rte_stops SET SHAPE = and I still get the error.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The feature class is versioned with move edits to base.&lt;/P&gt;&lt;P&gt;SQL 2016 on 2012 windows server&lt;/P&gt;&lt;P&gt;Desktop 10.6&lt;/P&gt;&lt;P&gt;Server 10.5&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edit:&lt;/P&gt;&lt;P&gt;+========================----------------------=================+&lt;/P&gt;&lt;P&gt;I wasn't able to resolve the direct creation of a single feature with a single input statement. If I chunked it up into an insert and add the stop info like address, inspection id's, etc and then call Update, it works.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;objectid is obtained from a single call to&amp;nbsp;SELECT MAX(OBJECTID) and incremented as needed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;INSERT&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;INTO&lt;/SPAN&gt; BLDG_RTE_STOPS &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;objectid&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; x&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; y&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;VALUES&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;5&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;-&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;8941512.462&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;3156974.749&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;


&lt;SPAN class="keyword token"&gt;update&lt;/SPAN&gt; BLDG_RTE_STOPS &lt;SPAN class="keyword token"&gt;set&lt;/SPAN&gt; SHAPE &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;geometry&lt;/SPAN&gt;::&lt;SPAN class="keyword token"&gt;Point&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;x&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;y&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;3857&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;where&lt;/SPAN&gt; OBJECTID&lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;5&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 12 Dec 2021 09:16:50 GMT</pubDate>
    <dc:creator>MichaelKohler</dc:creator>
    <dc:date>2021-12-12T09:16:50Z</dc:date>
    <item>
      <title>Add records to SQL from VB.NET</title>
      <link>https://community.esri.com/t5/developers-questions/add-records-to-sql-from-vb-net/m-p/800706#M5351</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have a requirement to show routes from optimized routing. I have the routing complete and working and now I want to add the route to a map. I added to stops to maps by using the rest add feature call to the server. No problem with 30+ stops. The routes have hundreds of segments in the returned path. I need to show the direction of the paths with arrows at the end. I'm not going to write hundreds of segments to a rest endpoint for a couple dozen routes. I want to add the segments to a SQL database. I've been trying everything and I can add, update and delete as expected but when I try to calculate the SHAPE I get the following error that I can't find anything about.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;The UPDATE statement conflicted with the CHECK constraint "g90_ck". The conflict occurred in database "PSLGIS2", table "dbo.BLDG_RTE_STOPS", column 'SHAPE'.‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The sql statement I am sending is&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;INSERT&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;INTO&lt;/SPAN&gt; BLDG_RTE_STOPS &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;objectid&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; inspID&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; stopOrder&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;inputOrder&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; address&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; x&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; y&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; SHAPE&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;VALUES&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;3&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;208&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;1&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;2&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'123 sw psl blvd'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;-&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;8943761.976904802&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;3157847.4254109007&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;&lt;SPAN class="keyword token"&gt;geometry&lt;/SPAN&gt;::STPointFromText&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;'POINT(-8943761.97 3157847.42)'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;3587&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I can add the attributes and create a new record without issue. I try to run an UPDATE bldg_rte_stops SET SHAPE = and I still get the error.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The feature class is versioned with move edits to base.&lt;/P&gt;&lt;P&gt;SQL 2016 on 2012 windows server&lt;/P&gt;&lt;P&gt;Desktop 10.6&lt;/P&gt;&lt;P&gt;Server 10.5&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edit:&lt;/P&gt;&lt;P&gt;+========================----------------------=================+&lt;/P&gt;&lt;P&gt;I wasn't able to resolve the direct creation of a single feature with a single input statement. If I chunked it up into an insert and add the stop info like address, inspection id's, etc and then call Update, it works.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;objectid is obtained from a single call to&amp;nbsp;SELECT MAX(OBJECTID) and incremented as needed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;INSERT&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;INTO&lt;/SPAN&gt; BLDG_RTE_STOPS &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;objectid&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; x&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; y&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;VALUES&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;5&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;-&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;8941512.462&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;3156974.749&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;


&lt;SPAN class="keyword token"&gt;update&lt;/SPAN&gt; BLDG_RTE_STOPS &lt;SPAN class="keyword token"&gt;set&lt;/SPAN&gt; SHAPE &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;geometry&lt;/SPAN&gt;::&lt;SPAN class="keyword token"&gt;Point&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;x&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;y&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;3857&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;where&lt;/SPAN&gt; OBJECTID&lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;5&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 09:16:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/developers-questions/add-records-to-sql-from-vb-net/m-p/800706#M5351</guid>
      <dc:creator>MichaelKohler</dc:creator>
      <dc:date>2021-12-12T09:16:50Z</dc:date>
    </item>
  </channel>
</rss>

