Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_databases thread: Subject: re: Script fails if any SQL fields are null


Message #1 by "Cotton, Joe" <Joe_Cotton@s...> on Mon, 2 Dec 2002 12:03:37 -0500
Use the isnull(var-to-check, if-its-null-this-is-returned) function: 
    &nbsp;<%=isnull(rsECBCon("PersonFirstName"),"default string")%> 
this will convert your nulls to some default string that you provide. 
Joe 



Subject: Script fails if any SQL fields are null 
From: Neile Bermudes <Neile.Bermudes@e...> 
Date: Fri, 29 Nov 2002 16:17:52 -0000 

Hi, 

I've got an ASP script that searches for information in an SQL database. 
It returns rows according to the search criteria it picks up from the user
HTML form i've created. The script runs perfectlt (after help from some of
you guys) but it will fail if any of the fields it is supposed to return are
NULL. I've tired updating my SQL tables with an update statement, changing
all null fields to contain some value, but that didn't work. So i'm
wondering if i can add something to my script that will enable it to return
null values too? 

Here's my script:<lots of code snipped out...) 
<% 
        Do While Not rsECBCon.EOF 
%> 
  <tr> 
    <td width="152"><%=rsECBCon("PersonTitle")%> 
    &nbsp;<%=rsECBCon("PersonFirstName")%> 
    &nbsp;<%=rsECBCon("PersonLastName")%> 
    </td> 


  

  Return to Index