title: MySQL query (sum) not working in VB
body: <p>I want to add the ages of all the employees in MySQL database column(using sum query) and then want to display its result(the value)on the click of a button in VB in a textbox.I have given a try but its not working.I am not able to figure this out.Please help....<a href="http://i.stack.imgur.com/IguiN.png" rel="nofollow">Image</a></p>
  
  <pre><code>Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
  
  Dim Mysqlconn As New MySqlConnection
  
  Mysqlconn.ConnectionString = "server=localhost;userid=root;port=85;password=andy1234;database=data"
  
  
  
  Try
      Mysqlconn.Open()
      command.Connection = Mysqlconn
  
      command.CommandText = "select sum(age) from data.etable"
  
      Dim sqlresult As Object
      sqlresult = command.ExecuteScalar
  
      Dim str As String
      str = sqlresult
      TextBox5.Text = str
  
      Mysqlconn.Close()
  
  Catch ex As MySqlException
      MessageBox.Show(ex.Message)
      Mysqlconn.Dispose()
  
  End Try
  End Sub
  </code></pre>