datatable.compute

  • Thread starter Thread starter Chuck Hecht
  • Start date Start date
C

Chuck Hecht

Hello

I am getting a Syntax error in the compute method of a datatable. I want to
SUM the qty field based on a

filter expression and the expression contains 3 fields. Non of the MSDN
documentation nor any other

references tell me I can not do this.



dim str as string =""

str = "item_num =" & "'" & gitem_num & "' + " & "lot_num =" & "'" & gLot_num
& "' + " & "lot_ext =" & "'" & gLot_ext & "'"

TotalPickQty = Convert.ToInt32(dtreceivepdai.Compute("SUM(qty)", str))



{System.Data.SyntaxErrorException}

System.Data.SyntaxErrorException: {"Syntax error: Missing operand after
'5106030' operator."}
 
Hello

I am getting a Syntax error in the compute method of a datatable. I want to
SUM the qty field based on a

filter expression and the expression contains 3 fields. Non of the MSDN
documentation nor any other

references tell me I can not do this.



dim str as string =""

str = "item_num =" & "'" & gitem_num & "' + " & "lot_num =" & "'" & gLot_num
& "' + " & "lot_ext =" & "'" & gLot_ext & "'"

TotalPickQty = Convert.ToInt32(dtreceivepdai.Compute("SUM(qty)", str))



{System.Data.SyntaxErrorException}

System.Data.SyntaxErrorException: {"Syntax error: Missing operand after
'5106030' operator."}

Are you sure your "str" (row filter) is correct? Try creating a
DataView with that RowFilter and see if you get any errors:

Dim dv as DataView = New DataView(dtreceivepdai)
dv.RowFilter = str
 
Back
Top