title: LINQ to SQL - The database generated a key that is already in use
body: <p>I have a simple problem that reads an Excel file (using interop) and fills an MSSQL database file with some data extracted from it. That's fine so far.
  I have a Shops table with the following fields:</p>
  
  <ul>
  <li>ID: int, auto-generated, auto-sync: on insert</li>
  <li>Name: string</li>
  <li>Settlement: string</li>
  <li>County: string</li>
  <li>Address: string</li>
  </ul>
  
  <p>I read the excel file, and then create a new Shops object and set the Name, Settlement, County and Address properties and I call Shops.InsertOnSubmit() with the new Shops object.</p>
  
  <p>After this I have to reset the database (at least, the table), for which the easiest way I found was to call the DeleteDatabase() method and then call CreateDatabase() again.
  The problem is, that after the first reset, when I try to fill the table again, I get the exception: The database generated a key that is already in use.</p>
  
  <p>Additionally, from that point on, I'm unable to use that database file, because DatabaseExists() returns FALSE, but when I call the CreateDatabase() method, it throws an exception, that the database already exists (although the data files don't exist).</p>
  
  <p>What am I doing wrong?
  Thank you very much in advance!</p>