AJAX how to return Null values

When using responseXML to return values from an asp document it will not return a NULL value or a blank value from the database without holding up the responseXML. How can I properly handle Null values without having to have somthing in the database field.  Right now I must have a value in the database field or the AJAX script does not complete the script. So how can  XML / AJAX ignore  the Nulls.

THE FOLLOWING IS THE AJAX:

function GetSystemEdit(SysID)
{
        
         xmlHttp = GetXmlHttpObject();
                       xmlHttp.onreadystatechange = ReturnGetSystem;
        xmlHttp.open('Get','EstimatesASP.asp?action=OpenSystem&SysID='+SysID, true);
        xmlHttp.send(null);
}


function ReturnGetSystem()
{

 if (xmlHttp.readyState == 4)
        {
             
            if (xmlHttp.status == 200)
          {
                    
                  var xmlDoc = xmlHttp.responseXML.documentElement;
                  
                  var System = xmlDoc.getElementsByTagName('System')[0].childNodes[0].nodeValue;
                  var DateEntered = xmlDoc.getElementsByTagName('DateEntered')[0].childNodes[0].nodeValue;
                var EnteredBy = xmlDoc.getElementsByTagName('EnteredBy')[0].childNodes[0].nodeValue;
                  var Notes = xmlDoc.getElementsByTagName('Notes')[0].childNodes[0].nodeValue;
                  var RCSNotes = xmlDoc.getElementsByTagName('RCSNotes')[0].childNodes[0].nodeValue;
                  var TaxRate = xmlDoc.getElementsByTagName('TaxRate')[0].childNodes[0].nodeValue;
                  var MU = xmlDoc.getElementsByTagName('MU')[0].childNodes[0].nodeValue;
                  var SysID = xmlDoc.getElementsByTagName('SysID')[0].childNodes[0].nodeValue;
                  

         }
             else
             {
            alert('There was a problem with the request.');
         }
      }
        
}







THE FOLLOWING IS THE ASP CODE:

Dim EstID
Dim XML
Dim System
Dim DateEntered
Dim EnteredBy
Dim TaxRate
Dim MU


SysID = CStr(Request.QueryString("SysID"))


XML = ""
     

      SQL = "SELECT * FROM Systems WHERE SystemID = "&SysID
      set rs=Server.CreateObject("ADODB.Recordset")
      rs.Open SQL, REDconnstring
      
      
      XML = XML + "<root>"      
      XML = XML + "<System>"&rs("System")&"</System>"
      XML = XML + "<DateEntered>"&rs("DateEntered")&"</DateEntered>"
      XML = XML + "<EnteredBy>"&rs("EnteredBy")&"</EnteredBy>"
      XML = XML + "<Notes>"&rs("Notes")&"</Notes>"
      XML = XML + "<RCSNotes>"&rs("RCSNotes")&"</RCSNotes>"
      'XML = XML + "<DateBid>"&rs("DateBid")&"</DateBid>"
      'XML = XML + "<DateWon>"&rs("DateWon")&"</DateWon>"
      XML = XML + "<TaxRate>"&rs("TaxRate")&"</TaxRate>"
      XML = XML + "<MU>"&rs("MU")&"</MU>"
      XML = XML + "<SysID>"&SysID&"</SysID>"
                     XML = XML + "</root>"


      
    set rs = nothing
      response.ContentType = "text/xml"
      response.Write(XML)




.
waf771Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

hieloCommented:
try:
XML = XML + "<root>"      
      XML = XML + "<System>" & rs.Fields("System").value & "</System>"
      XML = XML + "<DateEntered>" & rs.Fields("DateEntered").value & "</DateEntered>"
      XML = XML + "<EnteredBy>" & rs.Fields("EnteredBy").value & "</EnteredBy>"
      XML = XML + "<Notes>" & rs.Fields("Notes").value & "</Notes>"
      XML = XML + "<RCSNotes>" & rs.Fields("RCSNotes").value & "</RCSNotes>"
      'XML = XML + "<DateBid>" & rs.Fields("DateBid").value & "</DateBid>"
      'XML = XML + "<DateWon>" & rs.Fields("DateWon").value & "</DateWon>"
      XML = XML + "<TaxRate>" & rs.Fields("TaxRate").value & "</TaxRate>"
      XML = XML + "<MU>" & rs.Fields("MU").value & "</MU>"
      XML = XML + "<SysID>" & SysID & "</SysID>"
                     XML = XML + "</root>"

Open in new window

0
waf771Author Commented:
Still does not work. If the Notes field, for example, is empty in the database then the AJAX comand will not complete and nothing loads on my page, however if I put something back in that field then everything loads fine. So somehow it does not like an empty database field.
0
hieloCommented:
try using this:
SQL = "SELECT System,DateEntered,EnteredBy,Nz(Notes,'') as theNotes ,RCSNotes,DateBid,DateWon,TaxRate,MU FROM Systems WHERE SystemID = " & SysID


and instead of:
XML = XML + "<Notes>" & rs.Fields("Notes").value & "</Notes>"
 
use:
XML = XML + "<Notes>" & rs.Fields("theNotes").value & "</Notes>"
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

waf771Author Commented:
That comes up with "There was a problem with the request".  Can you Explain.......Nz(Notes,'') as theNotes .....to me?.
0
hieloCommented:
>>Can you Explain.......Nz(Notes,'') ...
Basically Nz acts as an If-Else.
http://www.techonthenet.com/access/functions/advanced/nz.php

Intead of
..., Nz(notes,'') as theNotes, ...

try:
..., IIF(notes,notes,'') as theNotes, ...

If that still doesn't work try:
..., IIF(Not isNull(notes),notes,'') as theNotes, ...

0
waf771Author Commented:
mmmm..I still get "There was a problem with the request".  I traded out IIF for IF   and it still does not seem to work...  I also traded out ..., IIF(Not isNull(notes),notes,'') as theNotes, ...   For just 'Notes'  as well as changed ....rs.Fields("RCSNotes").value..... back to  ....rs.Fields("Notes").value.....and it works fine so long as there is no null,  so i know the rest of my syntax is good.  
0
waf771Author Commented:
By the way I am using SQL 2005, and not Acess. That may make a diffrence.
0
hieloCommented:
Nz is for access. Try:

SQL = "SELECT System,DateEntered,EnteredBy, COALESCE(Notes,'') as theNotes ,RCSNotes,DateBid,DateWon,TaxRate,MU FROM Systems WHERE SystemID = " & SysID
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
waf771Author Commented:
Thanks so much
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
AJAX

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.