Professional Web Applications Themes

Blank fields in database - ASP 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....

  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. #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" <Suehotmail.com> wrote in message
    news:0c1001c47b03$ccc11220$a601280aphx.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

  3. #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" <Suehotmail.com> wrote in message
    >news:0c1001c47b03$ccc11220$a601280aphx.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

  4. #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

  5. #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

  6. #6

    Default Re: Blank fields in database

    "Sue" <Suehotmail.com> wrote in message
    news:0c1001c47b03$ccc11220$a601280aphx.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

  7. #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" <NewsMcKirahan.com> wrote in message
    news:uXIQc.235664$JR4.13258attbi_s54...
    > "Sue" <Suehotmail.com> wrote in message
    > news:0c1001c47b03$ccc11220$a601280aphx.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

  8. #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

Similar Threads

  1. Help with Access fields when they are to remain blank
    By I Need Help! in forum Dreamweaver AppDev
    Replies: 7
    Last Post: May 3rd, 11:33 PM
  2. Rejecting blank fields in forms
    By Steve in forum PHP Development
    Replies: 3
    Last Post: April 6th, 01:55 AM
  3. ASP & Mysql - Problem with blank text fields
    By Joel in forum ASP Database
    Replies: 1
    Last Post: August 1st, 03:18 PM
  4. Datasheet Fields Blank
    By Andrew H in forum Microsoft Access
    Replies: 4
    Last Post: July 4th, 01:48 PM
  5. Blank form fields passed to SQL
    By The ScareCrow in forum Macromedia Dynamic HTML
    Replies: 0
    Last Post: June 26th, 03:14 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not 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