473,659 Members | 3,420 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ASP & html tables : have strange problem

I have a section of ASP code that dynamically builds a table. And per
usual it writes out to the table like so:

Response.Write( "<td><font face=""Verdana" " size=""2""><b> Status
</b></font></td>")
Response.Write( "<td><font face=""Verdana" " size=""2""><b> Description
</b></font></td>")

' make a couple of column headers

Do While Not objRS.EOF

Response.Write( "<td><font face=""Verdana" " size=""2"">" &
objRS("chg_stat ") & "</font>" & "</td>")
Response.Write( "<td><font face=""Verdana" " size=""2"">" &
bjRS("co_desc") & "</font>" & "</td></tr>")

ObjRS.MoveNext

Loop

Response.Write "</table>"
'Clean up
'Response.Write "The Sql just executed was:: " &
"<br>" & strSql& "<br>" ' see the sql and check it in enterprise mngr

objRS.Close
Set objRS = Nothing
ObjConn.Close
Set objConn = Nothing
NOW THE PART THAT DRIVES ME CRAZY.

The actual code invloves alot more columns/rows and the recordset is
good size.
The problem is this:

Once I get 6 columns, no matter how I adjust the width, etc, I start
losing my data... a line that looks like this:

Response.Write( "<td><font face=""Verdana" " size=""2"">" &
objRS("chg_stat ") & "</font>" & "</td>")

and has data in the recordset element will (after column #6) result in

<td></td>

in the resluting html... I worked on this for 4 hours Friday. To
sanity check myself, I got 1 line of code working and then copied and
pasted so there are zero typos.

And again after 6 columns, the <td></td> started again with no data,
and you may rest assured my recordset object had data in those
variables at runtime....I know I checked.
I felt like I was losing my mind.
I'm also sort of new to ASP.
Any ideas at all?

TIA, most humbly.

Jul 19 '05 #1
3 1422
HenryW wrote on 21 mrt 2004 in microsoft.publi c.inetserver.as p.general:
Do While Not objRS.EOF

Response.Write( "<td><font face=""Verdana" " size=""2"">" &
objRS("chg_stat ") & "</font>" & "</td>")
Response.Write( "<td><font face=""Verdana" " size=""2"">" &
bjRS("co_desc") & "</font>" & "</td></tr>")

ObjRS.MoveNext

Loop


Where is the <tr> ???
the second objRS( misses an o

=============== ===========

[two " & " are superfluous, btw]
[use single quotes clientside, I advise]
["until" is the same as "while not"]
[do not use () after response.write-s]

To make the whole thing even more visually overseeable and debuggable,
make seperate <tr></tr>-s, <td>..</td>-s, use css, and indenting:

=============== ===========

<style>
.mytable tr td {font-family:verdana; font-size:1.1em}
</style>"
......
<table class='myTable' >
<%
Do Until objRS.EOF
Response.Write "<tr>"
Response.Write "<td>" & objRS("chg_stat ") & "</td>"
Response.Write "<td>" & objRS("co_desc" ) & "</td>"
Response.Write "</tr>"
ObjRS.MoveNext
Loop
%>
</table>

=============== ===========

or even [my personal preference]:

=============== ===========

<style>
.mytable tr td {font-family:verdana; font-size:1.1em}
</style>"
......
<table class='myTable' >

<%
Do Until objRS.EOF
%>
<tr>
<td><% = objRS("chg_stat ") %></td>
<td><% = objRS("co_desc" ) %></td>
</tr>
<%
ObjRS.MoveNext
Loop
%>

</table>

=============== ===========


--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jul 19 '05 #2
HenryW wrote:
I have a section of ASP code that dynamically builds a table. And per
usual it writes out to the table like so:

Response.Write( "<td><font face=""Verdana" " size=""2""><b> Status
</b></font></td>")
Response.Write( "<td><font face=""Verdana" " size=""2""><b> Description
</b></font></td>")

' make a couple of column headers

Do While Not objRS.EOF

Response.Write( "<td><font face=""Verdana" " size=""2"">" &
objRS("chg_stat ") & "</font>" & "</td>")
Response.Write( "<td><font face=""Verdana" " size=""2"">" &
bjRS("co_desc") & "</font>" & "</td></tr>")

ObjRS.MoveNext

Loop

Response.Write "</table>"
'Clean up
'Response.Write "The Sql just executed was:: " &
"<br>" & strSql& "<br>" ' see the sql and check it in enterprise mngr

objRS.Close
Set objRS = Nothing
ObjConn.Close
Set objConn = Nothing
NOW THE PART THAT DRIVES ME CRAZY.

The actual code invloves alot more columns/rows and the recordset is
good size.
The problem is this:

Once I get 6 columns, no matter how I adjust the width, etc, I start
losing my data... a line that looks like this:

Response.Write( "<td><font face=""Verdana" " size=""2"">" &
objRS("chg_stat ") & "</font>" & "</td>")

and has data in the recordset element will (after column #6) result in

<td></td>

in the resluting html... I worked on this for 4 hours Friday. To
sanity check myself, I got 1 line of code working and then copied and
pasted so there are zero typos.

And again after 6 columns, the <td></td> started again with no data,
and you may rest assured my recordset object had data in those
variables at runtime....I know I checked.
I felt like I was losing my mind.
I'm also sort of new to ASP.
Any ideas at all?

TIA, most humbly.


Firstly, do this to verify that your recordset contains all the data you
think it does:

response.write objRS.getString (,," | ", "<BR>")
Given that you seem to have checked your sql in Query Analyzer (you should
be using a stored procedure, not dynamic sql, but that's a topic for another
post - if you're interested, use Google to search for posts by me on this
topic), I suspect that it does contain your data, but it does not hurt to
verify it.

I suggest you use a GetRows array to populate your table instead of a
recordset loop. see this article for details:

http://www.aspfaq.com/show.asp?id=2467

If this does not help, we will need to see more of your looping code. what
you've shown above should work, so there has to be something we're not
seeing. The code to produce the header is totally irrelevant. All we need to
see is the section where you are looping through the fields in the recordset
(if you choose to persist in the klunky recordset loop instead of using the
more efficient array loop, that is)

Bob Barrows
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Jul 19 '05 #3
Evertjan

Thats real clean nice code, thanks I think it will help.

Bob thanks to you as well, I will look into the array thing, like I
said I'm new to ASP

Henry
HenryW wrote on 21 mrt 2004 in microsoft.publi c.inetserver.as p.general:
Do While Not objRS.EOF

Response.Write( "<td><font face=""Verdana" " size=""2"">" &
objRS("chg_stat ") & "</font>" & "</td>")
Response.Write( "<td><font face=""Verdana" " size=""2"">" &
bjRS("co_desc") & "</font>" & "</td></tr>")

ObjRS.MoveNext

Loop


Where is the <tr> ???
the second objRS( misses an o

============== ============

[two " & " are superfluous, btw]
[use single quotes clientside, I advise]
["until" is the same as "while not"]
[do not use () after response.write-s]

To make the whole thing even more visually overseeable and debuggable,
make seperate <tr></tr>-s, <td>..</td>-s, use css, and indenting:

============== ============

<style>
.mytable tr td {font-family:verdana; font-size:1.1em}
</style>"
.....
<table class='myTable' >
<%
Do Until objRS.EOF
Response.Write "<tr>"
Response.Write "<td>" & objRS("chg_stat ") & "</td>"
Response.Write "<td>" & objRS("co_desc" ) & "</td>"
Response.Write "</tr>"
ObjRS.MoveNext
Loop
%>
</table>

============== ============

or even [my personal preference]:

============== ============

<style>
.mytable tr td {font-family:verdana; font-size:1.1em}
</style>"
.....
<table class='myTable' >

<%
Do Until objRS.EOF
%>
<tr>
<td><% = objRS("chg_stat ") %></td>
<td><% = objRS("co_desc" ) %></td>
</tr>
<%
ObjRS.MoveNext
Loop
%>

</table>

============== ============


Jul 19 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

14
1852
by: CJM | last post by:
I have a query which produces different results in the Access query builder and in an ASP page (via ADO) An example of the query is: ---------------------------------------------------------- Select 'Ranked' as Source, H.HotelName, H.TelNo, H.URL, H.Location, H.HotelID, Rank from (Hotels H Inner Join PrefHotels P on H.HotelID = P.HotelID) Inner Join Locations L on P.LocID = L.LocID where Rank is not null and Rank > 0 and L.LocID=2
72
5395
by: Mel | last post by:
Are we going backwards ? (please excuse my spelling...) In my opinion an absolute YES ! Take a look at what we are doing ! we create TAGS, things like <H1> etc. and although there are tools (dreamweaver and the like), they are all at the lowest level of programming (something like assembly as oposed to C++ etc.). These tools create "brain-dead" developers that constantly have to plough through tons of tags to do the simplest thing. ...
39
5672
by: Zak McGregor | last post by:
Hi all Are there any good solutions to aligning form field names and input boxes without resorting to tables? I am struggling to do this nicely at the moment. Thanks Ciao Zak
3
4691
by: 21novembre | last post by:
Hi all, I made a question several days before to describe my strange trouble of mysqldump. But I still can't figour it out. Well, I just want to ask another question whether I could just backup my databases by copying the data folder to some place? Then if I meet some disaster, could I just copy the backup folder back to recover my databases? Thank you. Zh.y
5
2075
by: Bob N | last post by:
I have an ASP.NET web page -- several auto-post back DropDownLists that perform a query against a relatively large database (3 to 4 seconds delay) that repopulate a couple of datagrids, comboboxes and a chart (using dotnetCharting control) on the same page. This works just fine on its own. However, when I integrated the page into the rest of the site, it is then placed inside a frameset. Again, the page seems to work fine EXCEPT under the...
1
6414
by: ratnakarp | last post by:
Hi, I have a search text box. The user enters the value in the text box and click on enter button. In code behind on button click i'm writing the code to get the values from the database and binding it to a repeater control. This repeater control has multiple text boxes and buttons. Can you please tell me how can i do paging in this case ? I'm posting my code below. The problem is that if i click on "AdjustThisAd" button, it opens...
4
1595
by: Arthur Dent | last post by:
Hello all, ive been programming with ASP.NET since it came out, but am just getting my feet with now with v.2. Ive noticed something strange in the way my HTML tables get rendered with 2. I use tables to layout my pages, doing three rows, a header, content and footer. When i do this, i make the tables height=100%, so the footer always shows up at the very bottom of the page. With 2.0/2005 though, when it renders the pages, it doesnt...
2
7044
by: biganthony via AccessMonster.com | last post by:
Hi, I decided to install Office 2003 Service Pack 3 on my home computer to test (in full knowledge that there may be some issues with it). After installation, I have noticed that with a small database I wrote for home, the combo boxes and listboxes no longer display the bound column. For example, on a form I have a combo box based on a table called 'names'. The two columns in the combo box are ID and Surname. The combo box and list box...
16
3488
by: ARC | last post by:
Hello all, So I'm knee deep in this import utility program, and am coming up with all sorts of "gotcha's!". 1st off. On a "Find Duplicates Query", does anyone have a good solution for renaming the duplicate records? My thinking was to take the results of the duplicate query, and somehow have it number each line where there is a duplicate (tried a groups query, but "count" won't work), then do an update query to change the duplicate to...
0
8428
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8337
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8851
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8531
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7359
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6181
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4175
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2754
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1739
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.