database called form posting 'null' values

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

  1. #1

    Default database called form posting 'null' values

    I'm hoping someone can help me with my newbie question.

    I have a form which is calling from 2 tables, which are linked by a
    person's name. One table has information specific data to a thing and
    the other table has contact information such as address1, address2,
    city, state, zip, coutry, org, phone1, phone2, email. Currently, the
    information posts as the following example:

    Bob Jones
    111 South St.
    null
    Anywhere, NY, 14101 USA
    (202) 327 4511, null
    null

    wherein the blank database feilds are showing null. The way I have it
    set up is to call these values and insert it into a form table which
    is populated until EOF.

    I would like to have the null fields be ignored, but if I put an If
    NOT ISNULL into the table generating code, it comes up with an
    error...

    Am I being clear about the problem? If so...any ideas?

    Thanks,

    Jeremy
    Jeremy Guest

  2. Similar Questions and Discussions

    1. #26033 [Opn->Bgs]: imageftbbox gives anomalous values when first called
      ID: 26033 Updated by: sniper@php.net Reported By: robertks at hotmail dot com -Status: Open +Status: ...
    2. #26033 [Opn]: imageftbbox gives anomalous values when first called
      ID: 26033 User updated by: robertks at hotmail dot com Reported By: robertks at hotmail dot com Status: Open Bug...
    3. #26033 [NEW]: imageftbbox gives anomalous values when first called
      From: robertks at hotmail dot com Operating system: OpenBSD 3.1 PHP version: 4.3.1 PHP Bug Type: GD related Bug description:...
    4. Posting Unicode Form Values
      A really weird thing (to me, anyway) I've encountered is in a UTF-8 test script. Here, the input - a single two-byte Cyrillic character (as...
    5. Posting form to remote server via HTTP on from IIS - w/o form
      Hi all, Heres my dilemma; The target for my form data to be submitted to is an application running on a Mac Server (OS9) via 216.000.00.00:0000....
  3. #2

    Default Re: database called form posting 'null' values

    Jeremy wrote:
    > I'm hoping someone can help me with my newbie question.
    >
    > I have a form which is calling from 2 tables, which are linked by a
    > person's name. One table has information specific data to a thing and
    > the other table has contact information such as address1, address2,
    > city, state, zip, coutry, org, phone1, phone2, email. Currently, the
    > information posts as the following example:
    >
    > Bob Jones
    > 111 South St.
    > null
    > Anywhere, NY, 14101 USA
    > (202) 327 4511, null
    > null
    >
    > wherein the blank database feilds are showing null. The way I have it
    > set up is to call these values and insert it into a form table which
    > is populated until EOF.
    >
    > I would like to have the null fields be ignored, but if I put an If
    > NOT ISNULL into the table generating code, it comes up with an
    > error...
    >
    > Am I being clear about the problem? If so...any ideas?
    >
    > Thanks,
    >
    > Jeremy
    You need to show us the line of code you are using .... and tell us what the
    error is!

    Bob Barrows


    --
    Microsoft MVP - ASP/ASP.NET
    Please reply to the newsgroup. This email account is my spam trap so I
    don't check it very often. If you must reply off-line, then remove the
    "NO SPAM"


    Bob Barrows Guest

  4. #3

    Default Re: database called form posting 'null' values

    Hi

    I'm guessing you want this:
    > Bob Jones
    > 111 South St.
    > null
    > Anywhere, NY, 14101 USA
    > (202) 327 4511, null
    > null
    to be like this:
    > Bob Jones
    > 111 South St.
    > Anywhere, NY, 14101 USA
    > (202) 327 4511
    This depends on how you're extracting the data from the database. I'm
    assuming (again) that you're doing

    objRst.Open YourSQL

    Do Until objRst.EOF
    Response.Write objRst.Fields("Name") & "<BR />"
    Response.Write objRst.Fields("Address1") & "<BR />"
    Response.Write objRst.Fields("Address2") & "<BR />"
    Response.Write objRst.Fields("City") & "<BR />"
    ...

    objRst.MoveNext
    Loop

    What you need to do is add this function

    Private Function NZ(vntValue, vntNull)
    If IsNull(vntValue) Then
    NZ = vntNull
    Else
    NZ = vntValue
    End If
    End Function

    and change the lines
    Response.Write objRst.Fields("Name") & "<br />"
    to
    If Len(NZ(objRst.Fields("Name"),"")) <> 0 Then Response.Write
    objRst.Fields("Name") & "<br />

    The function NZ checks to see if the field is null, and if it is,
    replace it with vntNull which is "". By using len aroundn NZ, you can
    check Null and an empty string in one line because you cant do
    If IsNull(objRst.Fields("Name")) = False And objRst.Fields("Name")
    <> "" Then
    because if the field is null, the line will fail on the second test

    I hope this helps (and I've assumed correctly)

    Sam

    [email]jeremy_zifchock@yahoo.com[/email] (Jeremy) wrote in message news:<f9d85033.0402141110.6073f952@posting.google. com>...
    > I'm hoping someone can help me with my newbie question.
    >
    > I have a form which is calling from 2 tables, which are linked by a
    > person's name. One table has information specific data to a thing and
    > the other table has contact information such as address1, address2,
    > city, state, zip, coutry, org, phone1, phone2, email. Currently, the
    > information posts as the following example:
    >
    > Bob Jones
    > 111 South St.
    > null
    > Anywhere, NY, 14101 USA
    > (202) 327 4511, null
    > null
    >
    > wherein the blank database feilds are showing null. The way I have it
    > set up is to call these values and insert it into a form table which
    > is populated until EOF.
    >
    > I would like to have the null fields be ignored, but if I put an If
    > NOT ISNULL into the table generating code, it comes up with an
    > error...
    >
    > Am I being clear about the problem? If so...any ideas?
    >
    > Thanks,
    >
    > Jeremy
    Samuel Hon Guest

  5. #4

    Default Re: database called form posting 'null' values

    Thanks,

    But actually, my code is like this...

    <%@ language = "JavaScript" %>
    <%
    var strconnection = "Provider=Microsoft.Jet.OLEDB.4.0;Data
    Source=C:/Inetpub/wwwroot/ITI/fpdb/photo.mdb";
    %>

    <head>
    <script language=JavaScript>

    <%
    var tbl="";
    var rs = Server.CreateObject("ADODB.Recordset");
    var sql = "SELECT DISTINCT Photos.Photo, Photos.Artist,
    Artists.Organization, Artists.Address1 FROM Photos, Artists WHERE
    Photos.Artist = Artists.Artist";

    rs.Open(sql,strconnection);
    var n=0;
    while (!rs.EOF)
    {
    var img = rs.Fields("Photo");
    var art = rs.Fields("Artist");
    var org = rs.Fields("Organization");
    var ad1 = rs.Fields("Address1");

    {
    var tbl = tbl += "<table border='0'>\n";
    {
    tbl += " <td>\n";
    tbl += " <IMG src='images/" + img + "'>\n";
    tbl += " </td>\n";
    tbl += " <td>Artist:" + art + " \n";
    tbl += " <br>" + org + "\n";
    tbl += " <br> " + ad1 + "\n";
    }
    tbl += "</table>\n";
    }

    rs.MoveNext();
    n++;
    }

    rs.Close();
    Response.Write("document.repForm.write('" + tbl + "')")

    %>

    </script>
    </head>
    <html>

    <BODY>

    <%=tbl%>

    </BODY>
    </HTML>


    Hopefully this helps....

    Perhaps you'd suggest another way?.? I'd be happy to hear it.

    Thanks,

    Jeremy
    Jeremy Guest

  6. #5

    Default Re: database called form posting 'null' values

    Lost me now, my Javascript isnt that good. Handing over to the next man...

    [email]jeremy_zifchock@yahoo.com[/email] (Jeremy) wrote in message news:<f9d85033.0402161608.e971198@posting.google.c om>...
    > Thanks,
    >
    > But actually, my code is like this...
    >
    > <%@ language = "JavaScript" %>
    > <%
    > var strconnection = "Provider=Microsoft.Jet.OLEDB.4.0;Data
    > Source=C:/Inetpub/wwwroot/ITI/fpdb/photo.mdb";
    > %>
    >
    > <head>
    > <script language=JavaScript>
    >
    > <%
    > var tbl="";
    > var rs = Server.CreateObject("ADODB.Recordset");
    > var sql = "SELECT DISTINCT Photos.Photo, Photos.Artist,
    > Artists.Organization, Artists.Address1 FROM Photos, Artists WHERE
    > Photos.Artist = Artists.Artist";
    >
    > rs.Open(sql,strconnection);
    > var n=0;
    > while (!rs.EOF)
    > {
    > var img = rs.Fields("Photo");
    > var art = rs.Fields("Artist");
    > var org = rs.Fields("Organization");
    > var ad1 = rs.Fields("Address1");
    >
    > {
    > var tbl = tbl += "<table border='0'>\n";
    > {
    > tbl += " <td>\n";
    > tbl += " <IMG src='images/" + img + "'>\n";
    > tbl += " </td>\n";
    > tbl += " <td>Artist:" + art + " \n";
    > tbl += " <br>" + org + "\n";
    > tbl += " <br> " + ad1 + "\n";
    > }
    > tbl += "</table>\n";
    > }
    >
    > rs.MoveNext();
    > n++;
    > }
    >
    > rs.Close();
    > Response.Write("document.repForm.write('" + tbl + "')")
    >
    > %>
    >
    > </script>
    > </head>
    > <html>
    >
    > <BODY>
    >
    > <%=tbl%>
    >
    > </BODY>
    > </HTML>
    >
    >
    > Hopefully this helps....
    >
    > Perhaps you'd suggest another way?.? I'd be happy to hear it.
    >
    > Thanks,
    >
    > Jeremy
    Samuel Hon 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