[thelist] ASP help
Chris Blessing
webguy at mail.rit.edu
Tue Sep 10 12:50:01 CDT 2002
Michael, convert the value to a string as such:
if trim(objRs("SubText1")) <> "" then
blnSub1 = true
varSub1 = objRs("SubText1")
end if
This should convert null values to empty strings. Using the trim() function
also ensures that no empty spaces will make it through should the value be
empty.
If you do this for a lot of values you may be better off creating a function
like this:
function cleanData(str)
cleanData = trim(str)
end function
dim tmpStr
tmpStr = cleanData(objRs("SubText1"))
if tmpStr <> "" then
blnSub1 = true
varSub1 = tmpStr
end if
By creating the function you can add/remove other formatting functions like
format(), cstr(), etc.
HTH!
Chris Blessing
webguy at mail.rit.edu
http://www.330i.net
> Lots of great tips here, thank you.
> Turns out the problem is related to the database. Using code below:
>
> If objRs("SubText1") <> "" Or Not IsNull(objRs("SubText1")) Then
> blnSub1=True
> varSub1=objRs("SubText1")
>
> In some cases the column SubText1 is blank and in others is NULL. When the
> column is actually NULL the page displays fine, but if the column is just
> blank it displays the empty table. So it only sets blnSub1 to True is the
> columnm is NULL not if it's just blank.
>
> Suggestion?
>
More information about the thelist
mailing list