<?xml version="1.0" encoding="utf-8" ?>
<?xml-stylesheet type="text/xsl" href="RSS_xslt_style.asp" version="1.0" ?>
<rss version="2.0" xmlns:WebWizForums="http://syndication.webwiz.co.uk/rss_namespace/">
 <channel>
  <title>DevForce Community Forum : DuplicateKey Error</title>
  <link>http://www.ideablade.com/forum/</link>
  <description>This is an XML content feed of; DevForce Community Forum : DevForce Classic : DuplicateKey Error</description>
  <pubDate>Thu, 11 Jun 2026 09:25:22 -700</pubDate>
  <lastBuildDate>Tue, 29 Jan 2008 10:39:13 -700</lastBuildDate>
  <docs>http://blogs.law.harvard.edu/tech/rss</docs>
  <generator>Web Wiz Forums 9.69</generator>
  <ttl>360</ttl>
  <WebWizForums:feedURL>www.ideablade.com/forum/RSS_post_feed.asp?TID=625</WebWizForums:feedURL>
  <image>
   <title>DevForce Community Forum</title>
   <url>http://www.ideablade.com/forum/forum_images/IdeaBlade_logo_tm.png</url>
   <link>http://www.ideablade.com/forum/</link>
  </image>
  <item>
   <title>DuplicateKey Error : I&amp;#039;m afraid I don&amp;#039;t understand...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=625&amp;PID=2477#2477</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=43" rel="nofollow">pkarsh</a><br /><strong>Subject:</strong> 625<br /><strong>Posted:</strong> 29-Jan-2008 at 10:39am<br /><br />I'm afraid I don't understand your question.  How would deleting the last record of a table cause you to lose the value entered in the NextId table?  Are you trying to re-use primary keys of deleted records?  We recommend against that.  Under ordinary circumstances the Id generator and not end-users should be writing into the NextId table.  If for some reason you cannot adhere to this rule, then I suppose you could put your SaveChanges call into a try-catch loop (which is a good idea anyway) and do something to handle a Save failure due to a Duplicate key error.  If your primary keys are in ascending order, meaning, for example, that you would not assign a primary key of 3 after having assigned one of 4, then you might consider running a query to get the MAX value of the primary key column.<br /><br />If you wish to send me a private email to explain your situation in more detail then click on the link to my user name and you will see a button that will enable you to do so.<br /><br />Paul Karsh<br />IdeaBlade Support<br />]]>
   </description>
   <pubDate>Tue, 29 Jan 2008 10:39:13 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=625&amp;PID=2477#2477</guid>
  </item> 
  <item>
   <title>DuplicateKey Error : Dear Paul,about your second opinion,...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=625&amp;PID=2476#2476</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=219" rel="nofollow">aladdin</a><br /><strong>Subject:</strong> 625<br /><strong>Posted:</strong> 29-Jan-2008 at 9:29am<br /><br />Dear Paul,<br><br>about your second opinion, if deleted the last record of Invoices then NextId table loose the serial number, and<br><br>the user must be have permission to modify the NextId table. Now, if the user is stupid maybe save wrong id in <br><br>the NextId table. In this case we get a duplicate key error.How can to protect ? <br><br>Thanks<br>]]>
   </description>
   <pubDate>Tue, 29 Jan 2008 09:29:05 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=625&amp;PID=2476#2476</guid>
  </item> 
  <item>
   <title>DuplicateKey Error : If you were to use the Verification...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=625&amp;PID=2271#2271</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=43" rel="nofollow">pkarsh</a><br /><strong>Subject:</strong> 625<br /><strong>Posted:</strong> 19-Dec-2007 at 4:20pm<br /><br />If you were to use the Verification engine to try to catch this error you would have to write your own custom verifier.  In this case that would be quite complicated. That is probably not the right way to accomplish what you want to do.<br /><br />If you are using the PooledNumericIdGenerator then in your NextId table you have to have an entry for the name of the table that you are doing Id generation for.  If you have that then you should not get a duplicate key error.<br /><br />Hope this helps.<br /><br />Paul Karsh<br />IdeaBlade Support<br />]]>
   </description>
   <pubDate>Wed, 19 Dec 2007 16:20:39 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=625&amp;PID=2271#2271</guid>
  </item> 
  <item>
   <title>DuplicateKey Error : When create new entity(on added...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=625&amp;PID=2256#2256</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=219" rel="nofollow">aladdin</a><br /><strong>Subject:</strong> 625<br /><strong>Posted:</strong> 18-Dec-2007 at 2:15pm<br /><br />When create new entity(on added before save)&nbsp; the PersistenceManager use the PooledNumericIdGenerator class, to create primary key&nbsp; to non AutoIncrement field and post it -1.Now, after save if created duplicated key how can the Verification engine to catch the error unfortunately used AdoHelper methods.<br><br>Thanks for all.<br>]]>
   </description>
   <pubDate>Tue, 18 Dec 2007 14:15:40 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=625&amp;PID=2256#2256</guid>
  </item> 
 </channel>
</rss>