Blank fields in database

Ask a Question related to ASP Database, Design and Development.

  1. #1

    Default Blank fields in database

    Hi,

    I have a blank field in the database for Address. How do
    I refer to that? For ex:

    Set hrRS = Server.CreateObject("ADODB.Recordset")

    hrQuery ="SELECT DISTINCT
    Division,Description,Code,Address FROM tblEV3Location
    ORDER BY Division,Description;"

    hrRS.Open hrQuery,adoCon,2,2

    hrDiv = hrRS(0) + "-"+ hrRS(1)

    if hrRS(3)="" Then
    hrCode = hrRS(2)
    else
    hrCode = hrRS(2)+"-"+hrRS(3)
    End If

    This unfortunately doesnt work.

    Thanks.
    Sue Guest

  2. Similar Questions and Discussions

    1. Help with Access fields when they are to remain blank
      I have some sections of my database that will be left empty. I am trying to update my database via my web admin pages without any success. What...
    2. blank spaces in text fields in form
      I am a newbie. I have a simple form with just a few fields. A user fills out the form, goes to another page to preview his/her entries, and then may...
    3. Rejecting blank fields in forms
      Hi All, I hope that someone maybe able to help me with this question. At the moment I have the following line of code that checks if a field is...
    4. Datasheet Fields Blank
      Hi , When using a datasheet view on Subform. Everytime I move to the next record, my fields on the previous record which have the Requery...
    5. Blank form fields passed to SQL
      In your sql statement, check if the value is empty. I don't know what scripting language you are using so I will give an example using coldfusion ...
  3. #2

    Default Re: Blank fields in database

    What does "blank" mean? Is it an empty string, or is the value NULL? How
    did it get in there that way?

    And what on earth does "doesnt work" mean???

    --
    [url]http://www.aspfaq.com/[/url]
    (Reverse address to reply.)




    "Sue" <Sue@hotmail.com> wrote in message
    news:0c1001c47b03$ccc11220$a601280a@phx.gbl...
    > Hi,
    >
    > I have a blank field in the database for Address. How do
    > I refer to that? For ex:
    >
    > Set hrRS = Server.CreateObject("ADODB.Recordset")
    >
    > hrQuery ="SELECT DISTINCT
    > Division,Description,Code,Address FROM tblEV3Location
    > ORDER BY Division,Description;"
    >
    > hrRS.Open hrQuery,adoCon,2,2
    >
    > hrDiv = hrRS(0) + "-"+ hrRS(1)
    >
    > if hrRS(3)="" Then
    > hrCode = hrRS(2)
    > else
    > hrCode = hrRS(2)+"-"+hrRS(3)
    > End If
    >
    > This unfortunately doesnt work.
    >
    > Thanks.

    Aaron [SQL Server MVP] Guest

  4. #3

    Default Re: Blank fields in database

    blank as in there is no data in the field address

    doesnt work as in the drop-down is not displayed with any
    value if the address is blank in the database otherwise
    the drop-down have values.

    >-----Original Message-----
    >What does "blank" mean? Is it an empty string, or is
    the value NULL? How
    >did it get in there that way?
    >
    >And what on earth does "doesnt work" mean???
    >
    >--
    >[url]http://www.aspfaq.com/[/url]
    >(Reverse address to reply.)
    >
    >
    >
    >
    >"Sue" <Sue@hotmail.com> wrote in message
    >news:0c1001c47b03$ccc11220$a601280a@phx.gbl...
    >> Hi,
    >>
    >> I have a blank field in the database for Address. How
    do
    >> I refer to that? For ex:
    >>
    >> Set hrRS = Server.CreateObject("ADODB.Recordset")
    >>
    >> hrQuery ="SELECT DISTINCT
    >> Division,Description,Code,Address FROM tblEV3Location
    >> ORDER BY Division,Description;"
    >>
    >> hrRS.Open hrQuery,adoCon,2,2
    >>
    >> hrDiv = hrRS(0) + "-"+ hrRS(1)
    >>
    >> if hrRS(3)="" Then
    >> hrCode = hrRS(2)
    >> else
    >> hrCode = hrRS(2)+"-"+hrRS(3)
    >> End If
    >>
    >> This unfortunately doesnt work.
    >>
    >> Thanks.
    >
    >
    >.
    >
    sue Guest

  5. #4

    Default Re: Blank fields in database

    I guess the problem is that you aren't clear on the difference between empty
    string and null. Until then, change

    if hrRS(3)="" Then

    to

    if cstr(hrRS(3)) & "" = "" Then

    --
    [url]http://www.aspfaq.com/[/url]
    (Reverse address to reply.)


    Aaron [SQL Server MVP] Guest

  6. #5

    Default Re: Blank fields in database

    1)
    hrQuery ="SELECT DISTINCT
    isnull(Division,'') as Division ,isnull(Description,'') as ... etc FROM
    tblEV3Location
    ORDER BY Division,Description;"

    2)
    SET CONCAT_NULL_YIELDS_NULL { ON | OFF }

    --- see BOL (bookz online) -> SET CONCAT_NULL_YIELDS_NULL

    --
    -------
    Pawel Janowski
    [url]www.sunrise-tm.com[/url]
    [url]www.koluszki.net[/url]


    Pawel Janowski Guest

  7. #6

    Default Re: Blank fields in database

    "Sue" <Sue@hotmail.com> wrote in message
    news:0c1001c47b03$ccc11220$a601280a@phx.gbl...
    > Hi,
    >
    > I have a blank field in the database for Address. How do
    > I refer to that? For ex:
    >
    > Set hrRS = Server.CreateObject("ADODB.Recordset")
    >
    > hrQuery ="SELECT DISTINCT
    > Division,Description,Code,Address FROM tblEV3Location
    > ORDER BY Division,Description;"
    >
    > hrRS.Open hrQuery,adoCon,2,2
    >
    > hrDiv = hrRS(0) + "-"+ hrRS(1)
    >
    > if hrRS(3)="" Then
    > hrCode = hrRS(2)
    > else
    > hrCode = hrRS(2)+"-"+hrRS(3)
    > End If
    >
    > This unfortunately doesnt work.
    >
    > Thanks.
    Perhaps just enhancing the SQL statement with:

    WHERE Address <> ''


    McKirahan Guest

  8. #7

    Default Re: Blank fields in database

    That won't leave out rows where address is NULL, or address is ' '. I'm
    also not convinced that the OP didn't want the rows at all ...

    --
    [url]http://www.aspfaq.com/[/url]
    (Reverse address to reply.)




    "McKirahan" <News@McKirahan.com> wrote in message
    news:uXIQc.235664$JR4.13258@attbi_s54...
    > "Sue" <Sue@hotmail.com> wrote in message
    > news:0c1001c47b03$ccc11220$a601280a@phx.gbl...
    > > Hi,
    > >
    > > I have a blank field in the database for Address. How do
    > > I refer to that? For ex:
    > >
    > > Set hrRS = Server.CreateObject("ADODB.Recordset")
    > >
    > > hrQuery ="SELECT DISTINCT
    > > Division,Description,Code,Address FROM tblEV3Location
    > > ORDER BY Division,Description;"
    > >
    > > hrRS.Open hrQuery,adoCon,2,2
    > >
    > > hrDiv = hrRS(0) + "-"+ hrRS(1)
    > >
    > > if hrRS(3)="" Then
    > > hrCode = hrRS(2)
    > > else
    > > hrCode = hrRS(2)+"-"+hrRS(3)
    > > End If
    > >
    > > This unfortunately doesnt work.
    > >
    > > Thanks.
    >
    > Perhaps just enhancing the SQL statement with:
    >
    > WHERE Address <> ''
    >
    >

    Aaron [SQL Server MVP] Guest

  9. #8

    Default Re: Blank fields in database

    I think she is wanting to do concatenation, to me it reads:
    If hrRs(3) = "" then
    get the value from column 2
    else
    hrCode = column 2 and column 3
    end if

    So she just wants hrCode = hrRS(2) & "-" & hrRS(3)

    She was using ampersand as the join operator

    > if hrRS(3)="" Then
    > hrCode = hrRS(2)
    > else
    > hrCode = hrRS(2)+"-"+hrRS(3)
    > End If
    >
    > This unfortunately doesnt work.
    >
    > Thanks.

    Steven Scaife Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139