title: reset autoincrement when using a data adapter in c#
body: <p>I'm trying to take an existing Access database file (template.mdb) as a template for a new file.
  I want to drop some tables' rows (but keep other tables).
  I "access" the table via TableAdapters generated by Visual Studio 2010 (via add item -> data -> DataSet).</p>
  
  <p>While trying to drop some of the existing tables' contents and reset the auto increment counter I cannot accomplish the second task.
  I'm trying do this by </p>
  
  <pre><code>var adapter = new MyTableTableAdapter();
  var targetTable = adapter.GetData();
  // mark each row for deletion
  foreach (DataRow row in targetTable.Rows)
    row.Delete();
  </code></pre>
  
  <p>// found the following sequence <a href="https://stackoverflow.com/questions/5972699/reset-autoincrement-in-datatable">here</a>.</p>
  
  <pre><code>targetTable.IDProductColumn.AutoIncrement = true;
  targetTable.IDProductColumn.AutoIncrementSeed = 0;
  targetTable.IDProductColumn.AutoIncrementStep = -1;
  targetTable.IDProductColumn.AutoIncrementSeed = -1;
  
  // apply the changes
  adapter.Update(targetTable);
  </code></pre>
  
  <p>This indeed deletes the existing rows but doesn't reset the auto increment.</p>
  
  <p>How can this be accomplished?</p>
  
  <hr>
  
  <p>edit: complete workflow right now</p>
  
  <ol>
  <li>Copy the temple mdb file</li>
  <li>establish connection to copied file </li>
  <li>try to delete all rows of some tables, but not all</li>
  <li><p>read new data from an external xml file, containing references like this:</p>
  
  <p><code>&lt;tableARow&gt;&lt;id&gt;1&lt;/id&gt;&lt;/tableARow&gt;</code> // if this row get's an id &lt;> 1 ...</p>
  
  <p><code>&lt;tableBRow&gt;&lt;idRefTableARow&gt;1&lt;/idRefTableARow&gt;&lt;/tableBRow&gt;</code> // ... this row will not import correctly</p></li>
  <li>add this data to the "new" data base</li>
  </ol>