I am writing a code on VB and when the code executes my sql statement brings up an error
SQL statement:
"Select ISNULL(FirstName, '') + SPACE(1) + ISNULL(LastName, '') AS FullName, ClassID FROM StudentClassDetails, StudentsInfo where StudentsInfo.StudentID = StudentClassDetails.StudentID And StudentClassDetails.ClassID in '" & SelectedTitles.ToString & "'"
Error Message:
Incorrect syntax near '1,6,8,11,14,16,20,21,33,34'.
'1,6,8,11,14,16,20,21,33,34' is a string stored in SelectedTitles
Thanks in advance
SQL statement:
"Select ISNULL(FirstName, '') + SPACE(1) + ISNULL(LastName, '') AS FullName, ClassID FROM StudentClassDetails, StudentsInfo where StudentsInfo.StudentID = StudentClassDetails.StudentID And StudentClassDetails.ClassID in '" & SelectedTitles.ToString & "'"
Error Message:
Incorrect syntax near '1,6,8,11,14,16,20,21,33,34'.
'1,6,8,11,14,16,20,21,33,34' is a string stored in SelectedTitles
Thanks in advance