我有数据表,我正在尝试寻找ID以特定值开头的列的总和。我尝试了一些方法但遇到错误。
result=Convert.ToInt32(dtNew.Compute("Sum(ResPending)", "Substring(ID,0,1)='G'"));//error shows-- Substring() argument is out of range
并且也尝试了这种方式
dtNew.AsEnumerable().Where(x => x.Field<string>("ID").ToString().StartsWith("G"));//Expression can not contain lambda expression
您需要使用
Substring(ID,1,1)
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句