error in sql statement
-
hi :( i am working in vb program and ther is error in my sql
SELECT * From ClassRoom Where Capacity >= " & SumCapacity & " and RoomID not in(SELECT RoomID from [Slot] where SlotID= " & Slots4Sec.Tables("Slot").Rows(0).Item(0) & " or SlotID= " & Slots4Sec.Tables("Slot").Rows(1).Item(0) & " or SlotID =" & Slots4Sec.Tables("Slot").Rows(2).Item(0) & " or SlotID =" & Slots4Sec.Tables("Slot").Rows(3).Item(0) & ")" & "ORDER BY Capacity asc"
can any body find the error please i am Sure about table names and type and iam using access db :sigh: :sigh: -
hi :( i am working in vb program and ther is error in my sql
SELECT * From ClassRoom Where Capacity >= " & SumCapacity & " and RoomID not in(SELECT RoomID from [Slot] where SlotID= " & Slots4Sec.Tables("Slot").Rows(0).Item(0) & " or SlotID= " & Slots4Sec.Tables("Slot").Rows(1).Item(0) & " or SlotID =" & Slots4Sec.Tables("Slot").Rows(2).Item(0) & " or SlotID =" & Slots4Sec.Tables("Slot").Rows(3).Item(0) & ")" & "ORDER BY Capacity asc"
can any body find the error please i am Sure about table names and type and iam using access db :sigh: :sigh: -
What error message do you get?
I Love T-SQL Don't torture yourself,let the life to do it for you.
-
hi Blue_Boy when i fill may data set it gives error (Data type mismatch in criteria expression)
Parameter values which you add include inside single quotes.
" SELECT * From ClassRoom Where Capacity >= '" & SumCapacity & "' and RoomID not in(SELECT RoomID from [Slot] where SlotID= '" & Slots4Sec.Tables("Slot").Rows(0).Item(0) & "' or SlotID= '" & Slots4Sec.Tables("Slot").Rows(1).Item(0) & "' or SlotID ='" & Slots4Sec.Tables("Slot").Rows(2).Item(0) & "' or SlotID ='" & Slots4Sec.Tables("Slot").Rows(3).Item(0) & "') " & " ORDER BY Capacity asc"
I Love T-SQL Don't torture yourself,let the life to do it for you.
-
Parameter values which you add include inside single quotes.
" SELECT * From ClassRoom Where Capacity >= '" & SumCapacity & "' and RoomID not in(SELECT RoomID from [Slot] where SlotID= '" & Slots4Sec.Tables("Slot").Rows(0).Item(0) & "' or SlotID= '" & Slots4Sec.Tables("Slot").Rows(1).Item(0) & "' or SlotID ='" & Slots4Sec.Tables("Slot").Rows(2).Item(0) & "' or SlotID ='" & Slots4Sec.Tables("Slot").Rows(3).Item(0) & "') " & " ORDER BY Capacity asc"
I Love T-SQL Don't torture yourself,let the life to do it for you.
-
thanks :laugh: :laugh: i found the error it was that the type of roomid is different in the to table thanks so much