Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Confused Sorting a HTML table with dynamic data

Status
Not open for further replies.

maverik59

Programmer
Oct 30, 2002
67
GB
Hi,I'm having trouble listing records directly next to the current record in a table. Eg

<table>
<%Do while Not objRst.eof %>
<tr>
<td><%Response.write objRst("field_1_title")%></td>
<td> </td>
<td> </td>
</tr>
<tr>
<td><%Response.write objRst("field_2")%></td>
<td> </td>
<td> </td>
</tr>
<tr>
<td><%Response.write objRst("field_2")%></td>
<td> </td>
<td> </td>
</tr>
<tr>
<td><%Response.write objRst("field_3")%> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<% objRst.MoveNext %>

<% LOOP %>
</table>


Where each ' ' is i would like the details of the subsequent record and its field within the database, u get me? anyideas? Many Thanks

 
Do you mean details like the field name, field type, etc? Not sure I understand...

If you do want that type of info you can get it from the Field object. Basically when you say rs("field_1") you are referring to a field inide the curent record you are queued to, the default method of that field being it's value. You also have a lot of other things you can pull out though, such as the rtype, size, and a properties collection based on the database type you are connecting to.

Here is an example of some of those field methods and the properties colection of the field object:
Code:
Dim fld, prop
Response.Write "<table><tr><th>Field Name</th><th>Value</th><th>Defined Size</th><th>Data Type</th><th>Precision</th>"

'Properties Collection headers
For Each prop in rs(0).Properties
	Response.Write "<th>" & prop.Name & "</th>"
Next

response.Write "</tr>"

'Display the characteristics of each field for curently queued record
For Each fld in rs.Fields
	Response.Write "<tr><td>" & rs(0).Name & "</td>"
	Response.Write "<td>" & rs(0).Value & "</td>"
	Response.Write "<td>" & rs(0).DefinedSize & "</td>"
	Response.Write "<td>" & rs(0).Type & "</td>"
	Response.Write "<td>" & rs(0).Precision & "</td>"
	'All of the Properties in propertie collection for Fields
	For Each prop in fld.Properties
		Response.Write "<td>" & prop & "</td>"
	Next
	Response.Write "</tr>"
Next
Response.Write "</table>"

For more info on the Field object and it's Properties colleciton and methods: W3Schools has a reference.

-T

[sub]01000111 01101111 01110100 00100000 01000011 01101111 01100110 01100110 01100101 01100101 00111111[/sub]
The never-completed website:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top