When i run my program i get the error "Object refferance not set to an instance of object" im not sure what this is reffering to or how to fix this. i am trying to calculate the sum of all values within a colum of my database, Any help would be great.
DataTable table = ds.Tables["Finance"];
//Error Here
int sumIncome = Convert.ToInt32(table.Compute("SUM(Income)", string.Empty));
int sumExpenditure = Convert.ToInt32(table.Compute("SUM(Expenditure)", string.Empty));
int calc;
calc = sumIncome - sumExpenditure;
string ProfitLoss = $"{calc:C2}";
lblProfitLoss.Text = ProfitLoss.ToString();