Use the isnull(var-to-check, if-its-null-this-is-returned) function:
<%=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")%>
<%=rsECBCon("PersonFirstName")%>
<%=rsECBCon("PersonLastName")%>
</td>