title: How to convert datatable column values to an array by columnindex?
body: <p>I am currently working on a grading system where I have to place multiple int values into an array. These values are stored in an AccessDB under 18 columns. I am currently working on a method that grabs the column values from the DB and places them all in an Array. I found multiple solutions online, but they all require the column name as a string.</p>
  <p>Furthermore, I want to create a method that can take an index number for the columns instead of a string name. Here is a quick explanation of the method that I am creating:</p>
  <ol>
  <li>Grab values from grading subtest;</li>
  <li>Place values in array;</li>
  <li>Grade test;</li>
  <li>Clear array;</li>
  <li>Grab next subtest;</li>
  <li>Repeat process until all 18 subtests are done.</li>
  </ol>
  <p>Here is the code for the method i currently have:</p>
  <pre><code>using (var exportAdapter = new OleDbDataAdapter(ZoekQuery, connection))
                          {
                              exportAdapter.AcceptChangesDuringFill = false;
                              exportAdapter.Fill(NormDB);
                              Normen = NormDB.AsEnumerable().Select(d =&gt; d.Field&lt;int&gt;(1)).ToArray();
                              //testbox.Text = Normen.ToString();
                          }
  </code></pre>
  <p>As you can see, I place the DB values in a data table and then try to do place the values in an array. This current code crashes because d.field() only takes a string name as parameter and I want it to accept an index number.</p>
  <p>If the question is unclear, I can provide more info.</p>
  <p>thanks.</p>