title: VB - No default member found for type 'DBNull' when inserting data into an array
body: <p>I am trying to take data from a table and insert it into an array. However when I debug my code, Visual Studio returns this error:</p>
  <blockquote>
  <p>An unhandled exception of type 'System.MissingMemberException' occurred in Microsoft.VisualBasic.dll</p>
  <p>Additional information: No default member found for type 'DBNull'.</p>
  </blockquote>
  <p>The procedure that runs and causes this error is as follows:</p>
  <pre><code>Sub characterChecked(ByVal pronunciation As String)
      Dim query As String = &quot;SELECT Character FROM [Hiragana List] WHERE Pronunciation='&quot; &amp; pronunciation &amp; &quot;';&quot; 'Selects the character from the SQL table
      Dim instruction = New SqlCommand(query, sqlCon)
      Dim da As New SqlDataAdapter
      da.SelectCommand = instruction
      HiraganaList = New DataTable
      da.Fill(HiraganaList)
      dataArray(columnCount, rowCount) = HiraganaList.NewRow(0)(&quot;column&quot;) 'fills the first column in a row with the charater
      columnCount += 1 'Increments the coulmn count so that the pronunciation is in the same row as the character
  
      Dim query2 As String = &quot;SELECT Pronunciation FROM [Hiragana List] WHERE Pronunciation='&quot; &amp; pronunciation &amp; &quot;';&quot;
      Dim instruction2 = New SqlCommand(query, sqlCon)
      Dim da2 As New SqlDataAdapter
      da2.SelectCommand = instruction
      HiraganaList = New DataTable
      da2.Fill(HiraganaList)
      dataArray(columnCount, rowCount) = HiraganaList.NewRow(0)(&quot;row&quot;)
      rowCount += 1
  </code></pre>
  <p>And the debug breaks on this line:</p>
  <pre><code>dataArray(columnCount, rowCount) = HiraganaList.NewRow(0)(&quot;column&quot;) 'fills the first column in a row with the charater
  </code></pre>
  <p>The declarations for the array, the data table etc. are here:</p>
  <pre><code>Dim connectionString As String = &quot;Server=my_server;Database=name_of_db;User Id=user_name;Password=my_password&quot;
  Dim sqlCon = New SqlConnection(&quot;Data Source=(LocalDB)\v11.0;AttachDbFilename='J:\Computing Coursework\real project\KES\KES\Kana List.mdf';Integrated Security=True;Connect Timeout=30&quot;)
  Dim HiraganaList As DataTable
  Dim KanjiList As DataTable
  Dim Katakana As DataTable
  Dim YoonList As DataTable
  Dim YoonKataList As DataTable
  Dim columnCount As Integer = 1 'initialising the column and row counter for when data is inserted
  Dim rowCount As Integer = 1
  Dim varFileName As String = &quot;J:\Computing Coursework\real project\KES\Resources\csv.txt&quot;
  Dim dataArray(1, 1) As String
  </code></pre>
  <p>If anyone could help spot the problem within my code, it would be very helpful. Personally, I think that the error is caused by not inserting data into the array in the correct way, however I don't know if what I am doing is incorrect or does actually work.</p>