c# - Syntax error in aggregate argument: Expecting a single column argument with possible 'Child' qualifier -
datatable distincttable = dtable.defaultview.totable(true,"item_no","item_stock"); datatable dtsummerized = new datatable("summerizedresult"); dtsummerized.columns.add("item_no",typeof(string)); dtsummerized.columns.add("item_stock",typeof(double)); int count=0; foreach(datarow drow in distincttable.rows) { count++; //string itemno = convert.tostring(drow[0]); double totalitem = convert.todouble(drow[1]); string totalstock = dtable.compute("sum(" + totalitem + ")", "item_no=" + drow["item_no"].tostring()).tostring(); dtsummerized.rows.add(count,drow["item_no"],totalstock); } error message: syntax error in aggregate argument: expecting single column argument possible 'child' qualifier.
do can me out?
thanks.
you might try this:
dtable.compute("sum([" + totalitem + "])",""); i.e enclose column name in square brackets [ ]
the idea this post.
Comments
Post a Comment