本文介绍了语法错误不正确的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
请帮我找到错误
'Departments_Subjects_Junction'附近的语法不正确。
Dim da As 新 SqlDataAdapter( SELECT Subjects.subject_name FROM Subjects _
& INNER JOIN Departments_Subjects_Junction ON Subjects.subject_id = Departments_Subjects_Junction.subject_id _
& INNER JOIN Semesters_Subjects_Junction ON Subjects.subject_id = Semesters_Subjects_Junction.subject_id _
& WHERE Departments_Subjects_Junction.department_id = @DepartmentID AND Semesters_Subjects_Junction.semester_id = @SemeterID,con)
da.Selec tCommand.Parameters.AddWithValue( @ DepartmentID,departmentCb.ValueMember)
da.SelectCommand .Parameters.AddWithValue( @ SemesterID,semesterCb.ValueMember)
da.Fill( dt)
con.Close()
如果 dt.Rows.Count = 0 然后
MessageBox.Show( 否记录存在,再试一次, SORRY!,MessageBoxButtons.OK)
结束 如果
解决方案
Please help me find the error
Incorrect syntax near 'Departments_Subjects_Junction'.
Dim da As New SqlDataAdapter("SELECT Subjects.subject_name FROM Subjects" _ & "INNER JOIN Departments_Subjects_Junction ON Subjects.subject_id = Departments_Subjects_Junction.subject_id" _ & "INNER JOIN Semesters_Subjects_Junction ON Subjects.subject_id = Semesters_Subjects_Junction.subject_id" _ & "WHERE Departments_Subjects_Junction.department_id = @DepartmentID AND Semesters_Subjects_Junction.semester_id = @SemesterID", con) da.SelectCommand.Parameters.AddWithValue("@DepartmentID", departmentCb.ValueMember) da.SelectCommand.Parameters.AddWithValue("@SemesterID", semesterCb.ValueMember) da.Fill(dt) con.Close() If dt.Rows.Count = 0 Then MessageBox.Show("No record exists, try again", "SORRY!", MessageBoxButtons.OK) End If
解决方案
这篇关于语法错误不正确的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!