这个查询有什么问题?,我在我的vb net app中运行它,但是我得到了#34;语法错误(缺少运算符)",我从访问2016应用程序生成的工作sql查询中复制了。
查询:
Dim sqlquery As String = "Select tblCommissionsP.IDCommissionP, tblCategoryProducts.Nama, tblEmployees.Nama, tblCommissionsP.CommissionType, tblCommissionsP.CommissionRate
FROM tblCommissionsP INNER JOIN tblCategoryProducts On tblCommissionsP.IDCategoryProduct = tblCategoryProducts.IDCategoryProduct INNER JOIN tblEmployees On tblCommissionsP.IDEmployee = tblEmployees.IDEmployee"
错误:
System.Data.OleDb.OleDbException: 'Syntax error (missing operator) in query expression 'tblCommissionsP.IDCategoryProduct = tblCategoryProducts.IDCategoryProduct INNER JOIN tblEmployees On tblCommissionsP.IDEmployee = tblEmployees.IDEmploye'.'`enter code here`
答案 0 :(得分:0)
尝试将代码修改为:
Dim sqlquery As String = "Select tblCommissionsP.IDCommissionP, tblCategoryProducts.Nama, tblEmployees.Nama, tblCommissionsP.CommissionType, tblCommissionsP.CommissionRate" _
& " FROM tblCommissionsP INNER JOIN tblCategoryProducts On tblCommissionsP.IDCategoryProduct = tblCategoryProducts.IDCategoryProduct INNER JOIN tblEmployees On tblCommissionsP.IDEmployee = tblEmployees.IDEmployee"
答案 1 :(得分:0)
它现在有效,因为不止一个内连接,所以我必须放括号
(tblCommissionsP INNER JOIN tblCategoryProducts ON tblCommissionsP.IDCategoryProduct = tblCategoryProducts.IDCategoryProduct) INNER JOIN ...