locked
WHERE CLAUSE IN QUERY RRS feed

  • Question

  • User810354248 posted

    IN MY ASP.NET+VB CODE WEB WITH ACCESS DATABASE I AM USING FOLLOWING CODE

     SELECT PersData.NO, PersData.Name, PersData.POST, PersData.Course, qual.QUALIFICATION, qual.Recommendations FROM (PersData INNER JOIN qual ON PersData.NO = qual.NO) 

    WHERE (qual.QUALIFICATION = 'DEM') OR (qual.QUALIFICATION = 'DEL') AND (qual.QUALIFICATION = 'YO') 
    AND (Qual.QUALIFICATION NOT LIKE '*KKME*' OR Qual.QUALIFICATION NOT LIKE '*KKCT*' OR Qual.QUALIFICATION NOT LIKE '*KKLE*')
    AND (PERSADATA.POST NOT LIKE 'ENGR' OR PERSADATA.POST NOT LIKE 'SPVR')"

    IN WHERE CLAUSE

    QUALIFICATION KKME,KKCT, KKLE ARE NOT WORKING

    IN POST CLAUSE IS NOT ALSO WORKING

    THERE IS NO ERROR BUT EVEN AFTER USING NOT LIKE THE DATA DISPLAYS IN WEB PAGE

    Sunday, February 17, 2013 11:50 AM

Answers

  • User-1199946673 posted

    MY DATABASE IS IN ACCESS AND I AM USING ACCESSDATASOURCE IN ASP.NET

    Although the name suggests otherwise, when using an mdb file in ASP.NET, you're not actually dealing wuith an Access Database, nut wit a Jet Database Engine. And in Jet, the wildcard character is not * but %, like in SQL server....

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, February 18, 2013 4:41 PM

All replies

  • User465171450 posted

    * is not a wildcard in SQL. Use % instead.

    Sunday, February 17, 2013 1:20 PM
  • User810354248 posted

    MY DATABASE IS IN ACCESS AND I AM USING ACCESSDATASOURCE IN ASP.NET

    Sunday, February 17, 2013 8:31 PM
  • User-1716253493 posted
    im not sure what you want with the WHERE clouse. but i think the problem from AND condition that never match.
    Monday, February 18, 2013 10:50 AM
  • User1747761241 posted

    WHERE (qual.QUALIFICATION = 'DEM') OR (qual.QUALIFICATION = 'DEL') AND (qual.QUALIFICATION = 'YO') AND (Qual.QUALIFICATION NOT LIKE '*KKME*' OR Qual.QUALIFICATION NOT LIKE '*KKCT*' OR Qual.QUALIFICATION NOT LIKE '*KKLE*') AND (PERSADATA.POST NOT LIKE 'ENGR' OR PERSADATA.POST NOT LIKE 'SPVR')"

    Everything after the or is excluded.

    where qualification = 'DEM'  ; good so far

    or ( qualification = 'DEL') and (qaulification = 'YO')   ;this can never happen cant be DEL and YO and the rest is just anded onto this so it can never happen.

     

     

    ...

    or qualification not like '*KYLE*'

     

    Monday, February 18, 2013 3:37 PM
  • User-1199946673 posted

    MY DATABASE IS IN ACCESS AND I AM USING ACCESSDATASOURCE IN ASP.NET

    Although the name suggests otherwise, when using an mdb file in ASP.NET, you're not actually dealing wuith an Access Database, nut wit a Jet Database Engine. And in Jet, the wildcard character is not * but %, like in SQL server....

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, February 18, 2013 4:41 PM