How To Convert The DataTable Column type?

后端 未结 3 872
半阙折子戏
半阙折子戏 2020-12-22 05:10

I am trying to implement:

dtGroupedBy.Compute(\"sum(POWER)\",dvv.RowFilter); 

It results of an error:

Invalid usage

3条回答
  •  甜味超标
    2020-12-22 05:51

    Compute method supports expressions and they support the CONVERT function that you could use inside of the expression.

    For example, you could calculate sum of the column like

    MyDataTable.Compute("Sum(Convert(your column name, 'Data Type'))") 
    

提交回复
热议问题