Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. error in sql statement

error in sql statement

Scheduled Pinned Locked Moved Database
databasehelp
6 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    asha_s
    wrote on last edited by
    #1

    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:

    B 1 Reply Last reply
    0
    • A asha_s

      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:

      B Offline
      B Offline
      Blue_Boy
      wrote on last edited by
      #2

      What error message do you get?


      I Love T-SQL Don't torture yourself,let the life to do it for you.

      A 1 Reply Last reply
      0
      • B Blue_Boy

        What error message do you get?


        I Love T-SQL Don't torture yourself,let the life to do it for you.

        A Offline
        A Offline
        asha_s
        wrote on last edited by
        #3

        hi Blue_Boy when i fill may data set it gives error (Data type mismatch in criteria expression)

        B 1 Reply Last reply
        0
        • A asha_s

          hi Blue_Boy when i fill may data set it gives error (Data type mismatch in criteria expression)

          B Offline
          B Offline
          Blue_Boy
          wrote on last edited by
          #4

          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.

          A 1 Reply Last reply
          0
          • B Blue_Boy

            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.

            A Offline
            A Offline
            asha_s
            wrote on last edited by
            #5

            thanks :laugh: :laugh: i found the error it was that the type of roomid is different in the to table thanks so much

            B 1 Reply Last reply
            0
            • A asha_s

              thanks :laugh: :laugh: i found the error it was that the type of roomid is different in the to table thanks so much

              B Offline
              B Offline
              Blue_Boy
              wrote on last edited by
              #6

              You are welcome...


              I Love T-SQL Don't torture yourself,let the life to do it for you.

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups