title: VB.NET Calculate the sum of value in column in DataTable from mySQL Database
body: <p>Im a  bit confused. I have a mySQL database. It is hashed/encrypted. I used MySqlDataReader and my first query was:</p>
  
  <pre><code>SELECT SUM(column01) FROM dbtest.table01 WHERE column02 = '" &amp; encrypt(selectedValue, salt) &amp; "'
  </code></pre>
  
  <p>Problem is, the data inside the database is hashed/encrypted that is why it cannot compute the data. Now I switched to MySqlDataAdapter using this query I used in displaying the data in DataGridView(dehashed/decrypted data are displayed here):</p>
  
  <pre><code>SELECT column01 FROM dbtest.table01 WHERE column02 = '" &amp; encrypt(_selectedValue, salt) &amp; "'
  </code></pre>
  
  <p>Here is my code so far.</p>
  
  <pre><code>Dim dataAdapter As New MySqlDataAdapter
  Dim dataTable As New DataTable
  Dim bSource As New BindingSource
  
  Try
     conn.Open()
     Dim query As String
     query = "SELECT column01 FROM dbtest.table01 WHERE column02 = '" &amp; encrypt(_selectedValue, salt) &amp; "'"
     command = New MySqlCommand(query, conn)
     dataAdapter.SelectCommand = command
     dataAdapter.Fill(dataTable)
     bSource.DataSource = dataTable
     DataGridView_Moon.DataSource = bSource
  
     For i As Integer = 0 To dataTable.Rows.Count - 1
         dataTable.Rows(i)("column01") = decrypt(dataTable.Rows(i)("column01"), salt)
     Next
  
     conn.Close()
  Catch ex As Exception
  Finally
     conn.Dispose()
  End Try
  </code></pre>
  
  <p>If you could, pls place the totalValue into a messagebox. Thanks</p>