title: Summing rows in a DataTable, Expecting a single column argument with possible 'Child' qualifier
body: <p>I have a datatable object which is populated from a database query.</p>
  
  <p>I am trying to achieve a totals row using this function</p>
  
  <pre><code>Public Function getDataTable(data) As DataTable
  
      Dim theTable As New DataTable()
      theTable.Columns.Add(New DataColumn("Location"))
      theTable.Columns.Add(New DataColumn("Total Sales"))
      theTable.Columns.Add(New DataColumn("VAT"))
      theTable.Columns.Add(New DataColumn("Refunds"))
      theTable.Columns.Add(New DataColumn("VAT refund"))
      theTable.Columns.Add(New DataColumn("Total VAT"))
      theTable.Columns.Add(New DataColumn("Turnover"))
      theTable.Columns.Add(New DataColumn("Turnover Net"))
      ' Location, Sale value, VAT, Refund, VAT refund, Total Vat, Turnover (Gross) 
  
      For Each ele In data
          Dim thisRow As DataRow = theTable.NewRow()
          thisRow.Item("location") = ele("name")
          thisRow.Item("Total Sales") = "£" &amp; FormatNumber(ele("totalSales"), 2)
          thisRow.Item("VAT") = "£" &amp; FormatNumber(ele("totalVat"), 2)
          thisRow.Item("Refunds") = "£" &amp; FormatNumber(ele("refundTotal"), 2)
          thisRow.Item("VAT refund") = "£" &amp; FormatNumber(ele("vatRefunded"), 2)
          thisRow.Item("Total VAT") = "£" &amp; FormatNumber((ele("totalVat") - ele("vatRefunded")), 2)
          thisRow.Item("Turnover") = "£" &amp; FormatNumber(ele("netSales"), 2)
          thisRow.Item("Turnover Net") = "£" &amp; FormatNumber((ele("netSales") - ele("totalVat")), 2)
          theTable.Rows.Add(thisRow)
      Next
  
      Dim totalRow = theTable.NewRow
      For Each col As DataColumn In theTable.Columns
          If col.ColumnName &lt;&gt; "Location" Then
              Try
                  totalRow(col.ColumnName) = Convert.ToDouble(theTable.Compute("SUM(CONVERT([" &amp; col.ColumnName &amp; "], CHAR(64)))", Nothing).ToString)
              Catch ex As Exception
                  totalRow(col.ColumnName) = "grr"
              End Try
          Else
              totalRow("Location") = "Total"
          End If
      Next
      theTable.Rows.Add(totalRow)
  
      Return theTable
  End Function
  </code></pre>
  
  <p>As you can see, we're creating a table with 8 columns, the first one being a location name, and the rest being numbers. I am skipping the summing of the "location" row with a simple <code>if</code> clause.</p>
  
  <p>I keep getting this error though:</p>
  
  <pre><code>Expecting a single column argument with possible 'Child' qualifier.
  </code></pre>
  
  <p>I've read a few posts, but nothing seems to solve it.</p>
  
  <p>I thought the spaces in my column names might be an issue, this article suggested so:</p>
  
  <p><a href="http://forums.asp.net/t/1341960.aspx/1" rel="nofollow">http://forums.asp.net/t/1341960.aspx/1</a></p>
  
  <p>Adding the square brackets does not help.</p>
  
  <p>I have also tried adding ` characters, but that doesn't work</p>