title: VB.Net from table(time data type) to label
body: <p>I have a problem regarding producing report but before that I need to run a code in order for me to create multiple conditions for the next report.</p>
  
  <p>I have here a screenshot of my tbldtr. What I want is the value of am_time_in which has the data type of time will be transferred into a label/textbox/variable. I am using Visual Basic with MySQL.</p>
  
  <p>Here is my code</p>
  
  <pre><code>Public Class Form1
  
  Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
      checktime()
  End Sub
  
  Private Sub checktime()
      Dim cn As New MySqlConnection(CnPath)
      Dim Sql As String = "SELECT `tbldtr`.`am_time_in` FROM `tbldtr` WHERE `tbldtr`.`id` =  '11' AND `tbldtr`.`dtrdate` =  '2017-10-16'"
      Dim daCmd5 As New MySqlCommand(Sql, cn)
  
      cn.Open()
  
      Dim datinfo As MySqlDataReader = daCmd5.ExecuteReader()
  
      While datinfo.Read()
  
          If IsDBNull(datinfo(0)) = True Then
              lblamtimein.Text = ""
          Else
              lblamtimein.Text = datinfo(0)
          End If
      End While
      cn.Close()
  End Sub
  </code></pre>
  
  <p>End Class</p>
  
  <p>Error here:</p>
  
  <p><a href="https://i.stack.imgur.com/NGjuf.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/NGjuf.png" alt="enter image description here"></a>
  <a href="https://i.stack.imgur.com/d1q2K.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/d1q2K.png" alt="enter image description here"></a></p>