title: How to solve this: Conversion from type DBNull to type string is not valid
body: <ol>
  <li><p>I think this is were I think the error is showing when I close the crystal report after creating a report.</p>
  
  <pre><code>Private Sub Populate(id As Integer, perdate As Date, controlnum As String, establishmentname As String, fname As String, mname As String, lname As String, address As String, pertype As String, ornum As String, amntpd As String, datepd As Date)
  
  Dim row As String() = New String() {id, perdate, controlnum, establishmentname, fname, mname, lname, address, pertype, ornum, amntpd, datepd}
  
  DataGridView1.Rows.Add(row)
  
  End Sub
  </code></pre></li>
  </ol>
  
  <p>This is where the code for retrieving data from my database(MySql database) to datagrid view</p>
  
  <pre><code>    Private Sub retrieve()
      DataGridView1.Rows.Clear()
      sql = "SELECT * FROM tblfsesmis"
  
  
      Try
          Using con
              con.Open()
              cmd = New MySqlCommand(sql, con)
              adapter = New MySqlDataAdapter(cmd)
  
              adapter.Fill(dt)
  
              For Each row In dt.Rows
                  'It's in your Populate function that you want to check the DBNull values
                  Populate(row(0), row(1), row(2), row(3), row(4), row(5), row(6), row(7), row(8), row(9), row(10), row(11))
              Next
  
              dt.Rows.Clear()
              DataGridView1.Refresh()
          End Using 'con Object will be disposed automatically
      Catch ex As Exception
          MsgBox(ex.Message)
      End Try
  
  End Sub
  </code></pre>
  
  <p>Can you help me in how to solve this? please ! thank you</p>