Click to See Complete Forum and Search --> : Blank Cells
moose
Jan 17th, 2001, 01:00 PM
I have an html table that is being generated from data in a table (database table). I have connected to the database. However if a cell is empty in my database the cell for that table is not being drawn. It is like it leaves a hole in the page until the next record with data in it is populated. Can this be fixed. If I need to attach code I will.
Thanks.
sebs
Jan 17th, 2001, 02:07 PM
post your code
it will be easier if we see your code!!
moose
Jan 17th, 2001, 02:09 PM
Here is my code.
Thanks.
<%
Dim rsATL
set rsATL= server.createobject("ADODB.recordset")
rsATL.open "select * from extension where office='Atlanta'", "DSN=directory"
rsATL.MoveFirst
response.write "<div align='center'><font color=#2B4595><h1>Atlanta Directory</h1></font></div>"
response.write "<div align='center'>"
response.write "<Table border='1' width='550'><TR height=40>"
Response.Write "<TH><font color=#2B4595><u>Last Name</u></font></TH>"
Response.Write "<TH><font color=#2B4595><u>First Name</u></font></TH>"
Response.Write "<TH><font color=#2B4595><u>Extension</u></font></TH>"
Response.Write "<TH><font color=#2B4595><u>Mobile</u></font></TH>"
Response.Write "<TH><font color=#2B4595><u>Notes</TD></u></font></TH>"
do while not rsATL.eof
response.write "<TR><TD height=25>" & rsATL("Last_Name") & "</TD>"
response.write "<TD height=25>" & rsATL("First_Name") & "</TD>"
response.write "<TD height=25 align='center'>" & rsATL("Extension") & "</TD>"
response.write "<TD height=25 align='center'>" & rsATL("Mobile") & "</TD>"
response.write "<TD height=25>" & rsATL("Notes") & "</TD> </TR>"
rsATL.movenext
loop
response.write "</table>"
rsATL=close
set rsATL = nothing
%>
sebs
Jan 17th, 2001, 02:12 PM
you can do something like:
if rsATL("Last_Name") <> "" then
response.write "<TR><TD height=25>" & rsATL("Last_Name") & "</TD>"
else
response.write "<TR><TD height=25></TD>"
end if
...is that what you need??
moose
Jan 17th, 2001, 03:08 PM
Nope. Did not work. Thanks anyway. I need to tell it coming into the page, that the field is null. I think?!?!?
moose
Jan 17th, 2001, 03:32 PM
I tweaked with it long enough and the followig works!! It was not as hard as it appears. I sorta feel foolish that I did not think of it sooner!!!
Thanks again for your help.
if not isnull(rsATL.Fields("Mobile")) then
response.write "<TD height=25 align='center'>" & rsATL("Mobile") & "</TD>"
else
response.write "<TD height=25 bordercolor='#C0C0C0'> </TD>"
end if
[Edited by moose on 01-17-2001 at 05:09 PM]
I'm a bit surprised what you did works but well done.:) For properly formed HTML I'd use a non breaking space.
emptycell = "<td> </td>"
moose
Jan 17th, 2001, 04:10 PM
That's what I did I just forgot my non breaking space. I have added it to my code.
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.