.net根据数据库公式计算结果
DataTable dt = new DataTable(); String ev_A = 5.88.ToString(); String ev_B = 2.ToString(); String ev_C = 4.ToString(); String ev_W = 10.ToString(); String expression = "a+(w-b)*c"; expression = expression.Replace("a", ev_A); expression = expression.Replace("b", ev_B); expression = expression.Replace("c", ev_C); expression = expression.Replace("w", ev_W); decimal result=Convert.ToDecimal(dt.Compute(expression,"")); Console.WriteLine(Math.Round(result,2)); Console.ReadKey();