I'm trying to calculate the difference of sales and expenses from the database values that I have returned. But when I use a - b it throws the below error. Although I'm converting the double it still gives the error:
cannot implicitly convert type string to double
This is my code:
double a = Double.Parse(reader["sales"].ToString().Trim());
double b = Double.Parse(reader["expenses"].ToString().Trim());
Label11.Text = a - b;
Any help will be appreciated.
aandbproperly doubles? Have you tried doingLabel11.Text = (a-b).ToString();?