Bud
asked on
Display ONLY columns from DB record that are not NULL.
I have a SQL database that users populate that contains columns that will left NULL. How do I create an ASP page that shows the records from the DB but, does not list the columns that have NULL values?
try the below :-
<%while not rs.eof then %>
<tr align="center" valign="middle">
<td>
<%
if trim(rs("field1")) <> "" then
response.write rs("field1")
else
response.write("")
end if
%>
</td>
<td>
<%
if trim(rs("field2")) <> "" then
response.write rs("field2")
else
response.write ""
end if
%>
</td>
</tr>
<% rs.movenext
wend%>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
hello BudStear
u may want to check the following
https://www.experts-exchange.com/questions/21371136/check-if-record-field-is-empty.html
https://www.experts-exchange.com/questions/21372277/Hide-Region-if-field-is-empty.html
thanks
axr|aL
u may want to check the following
https://www.experts-exchange.com/questions/21371136/check-if-record-field-is-empty.html
https://www.experts-exchange.com/questions/21372277/Hide-Region-if-field-is-empty.html
thanks
axr|aL
<%do while not rs.eof then %>
<tr align="center" valign="middle">
<td>
<%
if rs("field1") = "" then
response.write ""
else
response.write rs("field1")
end if
%>
</td>
<td>
<%
if rs("field2") = "" then
response.write ""
else
response.write rs("field2")
end if
%>
</td>
</tr>
<%loop%>