I am getting a syntax error ” Missing operand after ‘Price’ operator” with the following code, which should be right but obviously isn’t. Any thoughts on where the error is?
table.Columns.Add("ADR Price", GetType(Double))
table.Columns.Add("ORD Price", GetType(Double))
table.Columns.Add("Currency Price", GetType(Double))
Dim cDiff As DataColumn = New DataColumn
With cDiff
.DataType = System.Type.GetType("System.Double")
.ColumnName = "Difference"
.Expression = "ADR Price - (ORD Price * Currency Price)"
End With
table.Columns.Add(cDiff)
I’m
fairlysure that the exception is caused by your whitespaces in the column-names.You should wrap the names in brackets or remove the spaces:
But then the next will probably walk into this trap. So in my opinion removing would be better: