Click to See Complete Forum and Search --> : Check Length Of Variable


gowans007
08-05-2004, 06:26 AM
I have a SQL & on returning the information I need to do a check to see that the variable holds infomation if not I need it to display something else.

Is there anyway in ASP to check the lengh of a string in a variable and if this is eqal to zero then to display something else?

Basically the data is altering the table size if it has no info in so where there is no data to display to display (<font color="#FFFFFF"> ------) </font> to keep the table looking neat!

gowans007
08-05-2004, 06:30 AM
tryed this but didnt work


If rs("TL") = "" then

response.write ("<tr class='bodytext'>")
response.write ("<td><div align='center'><strong> ------------ ")
response.write ("</strong></div></td>")
response.write ("<td><div align='center'> ------ ")
response.write ("</div></td>")
response.write ("<td><div align='center'> -- ")
response.write ("</div></td>")
response.write ("</tr>")

Else

response.write ("<tr class='bodytext'>")
response.write ("<td><div align='center'><strong>") & rs("TL")
response.write ("</strong></div></td>")
response.write ("<td><div align='center'>") & rs("Clearway")
response.write ("</div></td>")
response.write ("<td><div align='center'>") & rs("Comments")
response.write ("</div></td>")


response.write ("</tr>")

End If

schizo
08-05-2004, 09:10 AM
VBScript...

Len(varName)