I am trying to get the sum of the column TotalAmount
in my DataTable
dt
but I always get this error:
Object reference not set to an instance of an object.
I am using VB in Visual Studio 2012.
Here's the code:
Dim table As DataTable = CartDataSet.Tables("dt")
Dim result As Integer
result = table.Compute("SUM(TotalAmount)", "")