我使用 MySQL 查询浏览器尝试了下面的“SELECT”MYSQL 语法,工作正常。当我将此语法用于 dtTable.Select() 时,错误是“表达式语法错误”。请帮助我,谢谢。
Dim dtTable As DataTable = MyDataset.Tables("machine")
Dim sql As String = String.Format("SELECT product_name, operator_name, totalizer_name
FROM product, operator, totalizer_type, machine
WHERE product.product_id = machine.product_id AND
operator.operator_id = machine.operator_id AND
totalizer_type.totalizer_id = machine.totalizer_id
ORDER BY machine.machine_id ASC;")
Dim rowSearching() As DataRow
rowSearching = dtTable.Select(sql) ' <--- (error in here - "Syntax error on expression")
If rowSearching.Length > 0 Then
For Each dr As DataRow In rowSearching
MessageBox.Show(CStr(dr.Item(0)) & " " & CStr(dr.Item(1)) & " " & CStr(dr.Item(2)))
Next
End If