Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

nulls in an array

Status
Not open for further replies.
Aug 1, 2003
85
US
I'm getting an error in my array when the database has a null value.

Microsoft VBScript runtime error '800a005e'

Invalid use of Null: 'Split'

/intranet/test/tsrformadmin1.asp, line 706

So I wrote this to substitute a value for any nulls
<%
Dim tempvalue
If (Recordset1("Resolved_by") = null ) Then
tempvalue = "no admin"
else tempvalue = Recordset1("Resolved_by")
response.write tempvalue & "<br>"
End If
%>
<%
Dim MyArray2
MyArray2 = Split(tempvalue, ", ")
For i = 0 TO UBound(MyArray2)
response.write MyArray2(i)
next
%>

I believe I have a problem with "=null" , I never get "no admin" even when I know the value is null.
What's the correct way to write this code to equal a null value?
Thanks,
Dan
 
may be this:

If (Recordset1("Resolved_by")="" OR ISNULL(Recordset1("Resolved_by")="" )) Then

-DNG
 
The easiest way to deal with nulls in a recordset is to concatentate an empty string to the value. Then you can work with it easily. e.g:

myvalue = recordset("somefield") & ""



Tracy Dryden

Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard. [dragon]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top