本文介绍了我在使用Sql Join时遇到问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! SELECT Student.StudentID,(Student.FirstName + ' ' + Student.LastName) AS StudentName,Employee.EmployeeID,(Employee.FirstName + ' ' + Employee.LastName) FROM 学生 INNER JOIN 员工 ON 学生.BranchID = Employee.BranchID WHERE Student.BranchID OR Employee.BranchID = + ViewState [ BranchID ] +; 我在使用此Join时遇到问题。它显示以下内容错误.. 表达式在预期条件的上下文中指定的非布尔类型,在'OR'附近。解决方案 使用任何一个Student.BranchID / Employee.BranchID,但不是 在你没有指定valut的where条件下与Student.BranchID比较 WHERE Student.BranchID OR Employee.BranchID =+ ViewState [BranchID] +; 它应该像 WHERE Student.BranchID ='someValue' OR Employee.BranchID =+ ViewState [ BranchID] +; 这是一个愚蠢的错误。错误本身说的是: Quote:在预期条件的上下文中指定的非布尔类型的表达式,靠近OR。 / blockquote> 所以试试吧, SELECT Student.StudentID,(Student.FirstName +''+ Student.LastName) AS StudentName,Employee.EmployeeID,(Employee.FirstName +''+ Employee.LastName) FROM Student INNER JOIN Employee ON Student.BranchID = Employee.BranchID WHERE Student.BranchID =+ ViewState [BranchID ]+ OR Employee.BranchID =+ ViewState [BranchID]; -KR SELECT Student.StudentID,(Student.FirstName+' '+Student.LastName)AS StudentName,Employee.EmployeeID,(Employee.FirstName+' '+Employee.LastName)FROM Student INNER JOIN Employee ON Student.BranchID=Employee.BranchIDWHERE Student.BranchID OR Employee.BranchID="+ ViewState["BranchID"] + ";I am having trouble with this Join .It is Showing the following error..An expression of non-boolean type specified in a context where a condition is expected, near 'OR'. 解决方案 use any one either Student.BranchID/Employee.BranchID, but not bothin your where condition you have not specified valut to compare with Student.BranchIDWHERE Student.BranchID OR Employee.BranchID="+ ViewState["BranchID"] + ";It should be likeWHERE Student.BranchID='someValue' OR Employee.BranchID="+ ViewState["BranchID"] + ";It's a silly mistake. Error itself says something : Quote:An expression of non-boolean type specified in a context where a condition is expected, near 'OR'.So try with this,SELECT Student.StudentID,(Student.FirstName+' '+Student.LastName)AS StudentName,Employee.EmployeeID,(Employee.FirstName+' '+Employee.LastName)FROM Student INNER JOIN Employee ON Student.BranchID=Employee.BranchIDWHERE Student.BranchID="+ ViewState["BranchID"]"+ OR Employee.BranchID="+ ViewState["BranchID"]";-KR 这篇关于我在使用Sql Join时遇到问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云! 08-05 23:47