IS Null

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • amitpatel66
    Recognized Expert Top Contributor
    • Mar 2007
    • 2358

    #16
    Originally posted by OuTCasT
    hey there.
    this code works perfectly in query analyzer... but as soon as its on the page and ive only selected one value from the 3 dropdownlistbox es then nothing happens, only when i make all 3 choices the info pops up....
    why does it do that>

    ???
    I think this issue is related to front end part, where you need to select atleast NULL for the other two list box if you dont want to select any other value. Do you have a page with submit button or something, which you click after selecting a value form the three list boxes?

    Comment

    • OuTCasT
      Contributor
      • Jan 2008
      • 374

      #17
      Originally posted by amitpatel66
      I think this issue is related to front end part, where you need to select atleast NULL for the other two list box if you dont want to select any other value. Do you have a page with submit button or something, which you click after selecting a value form the three list boxes?

      yes i have a button that i click to submit.

      in the 3 dropdownboxes i used static values equal to the database instead of binding them.

      the first listitem in each is
      <asp:ListItem ></asp:ListItem>

      maybe its the null value that is not going through for the other selections.

      Comment

      • amitpatel66
        Recognized Expert Top Contributor
        • Mar 2007
        • 2358

        #18
        Originally posted by OuTCasT
        yes i have a button that i click to submit.

        in the 3 dropdownboxes i used static values equal to the database instead of binding them.

        the first listitem in each is
        <asp:ListItem ></asp:ListItem>

        maybe its the null value that is not going through for the other selections.
        NULL is not equal to 'Does not exist'

        Set the DEFAULT for all the three list boxes to NULL and then test. Check if it works that way?

        Comment

        • OuTCasT
          Contributor
          • Jan 2008
          • 374

          #19
          Originally posted by amitpatel66
          NULL is not equal to 'Does not exist'

          Set the DEFAULT for all the three list boxes to NULL and then test. Check if it works that way?
          no default setting in the properties

          Comment

          • amitpatel66
            Recognized Expert Top Contributor
            • Mar 2007
            • 2358

            #20
            Originally posted by OuTCasT
            no default setting in the properties
            If that is the case then why dont you CODE it on click of submit button. You can set the three variable values to NULL in your source code. Then on click of submit button, if you do not select any value from any of the list box, then the corresponding variable will be NULL. So This way NULL will be passed to the Query.

            Comment

            • OuTCasT
              Contributor
              • Jan 2008
              • 374

              #21
              Originally posted by amitpatel66
              If that is the case then why dont you CODE it on click of submit button. You can set the three variable values to NULL in your source code. Then on click of submit button, if you do not select any value from any of the list box, then the corresponding variable will be NULL. So This way NULL will be passed to the Query.
              This query that u helped me out with

              [CODE=sql]SELECT [title], [gender], [initials], [name], [surname], [birthdate], [postaladdress], [suburb], [city], [zipcode], [criminalrecord], [drivers], [maritalstatus], [dependants], [citizenship], [province], [contactref], [hometel], [cell], [jobtitle], [relocate], [emmigrate], [email], [worktel], [enddate], [startdate], [FIELD], [education], [company], [positionheld], [jobdescription], [contactperson], [contacttel], [startdate2], [contactperson3], [jobdescription3], [positionheld3], [company3], [enddate3], [startdate3], [contacttel3], [other] FROM [cvinformation] WHERE (([race] = CASE WHEN @race IS NOT NULL THEN @race ELSE [race] END) AND ([province] = CASE WHEN @province IS NOT NULL THEN @province ELSE [province] END) AND ([education] = CASE WHEN @education IS NOT NULL THEN @education ELSE [education] END))[/CODE]

              I found the problem, it looks for NULL values in the db...and most of the rows have not got any null values...so no data was being returnd.
              What i want is to leave them blank and not search the database for the NULL values just for the values that are selected ..???/
              so if i did leave like 2 selections out it would still give me the data...

              Comment

              • amitpatel66
                Recognized Expert Top Contributor
                • Mar 2007
                • 2358

                #22
                Can you check what is the value being passed for all the three parameters. After selecting the values from all the three listboxes, pint the variables to see what value it holds, and if you do not pass a value does it hold word 'NULL' or nothing??

                Comment

                • OuTCasT
                  Contributor
                  • Jan 2008
                  • 374

                  #23
                  Originally posted by amitpatel66
                  Can you check what is the value being passed for all the three parameters. After selecting the values from all the three listboxes, pint the variables to see what value it holds, and if you do not pass a value does it hold word 'NULL' or nothing??
                  The selections are searching for NULL if nothing is selected
                  but for those selections like

                  Gender:
                  Race:
                  Field of study:
                  Location:

                  when the user saves this information its not null, he insert information and what your query does is search those fields for null values...then it brings nothing back because there are no null values in those fields

                  What i want is even though i leave certain selection null and only choose the other 2 selections to bring back those ppl information ....is that possible ?

                  Comment

                  Working...