title: How to create an auto increment column and have it auto filled
body: <p>Here is my code:</p>
  
  <pre><code>private void AddAutoIncrementColumn(DataTable dt)
  {
      DataColumn column = new DataColumn();
      column.DataType = System.Type.GetType("System.Int32");
      column.AutoIncrement = true;
      column.AutoIncrementSeed = 0;
      column.AutoIncrementStep = 1;
  
  
      dt.Columns.Add(column);
  }
  </code></pre>
  
  <p>I have an existing DataTable and want to create an auto-incremented column. That is, when i create the column i want it to automatically fill in the value 0......x. I am using the code above. But it doesn't seem to work. Any suggestions?</p>