[thelist] dynamic tables
Dena Marchant
teke at pullman.com
Thu May 12 09:40:13 CDT 2005
It's asp.
my access db has about 30 of these tables.
the one in the example is like this
sw14_seq, sw14_distance, sw14_value
1 = 1,000 12
2 > 1,000 - 2,500 9
3 > 2,500 - 5,000 6
...
I'm using a function to build the tables on the page. Depending on several
factors
some of the tables will get called, some not.
sub subWRMForm(sQuery)
dim oConn, lastrecord, Path, dbConn, i, conntemp,rstemp,howmany,counter
Path = Server.MapPath ("ct_assess.mdb")
'Response.Write Path
Set oConn = Server.CreateObject("ADODB.Connection")
dbConn = "Provider=Microsoft.Jet.OLEDB.4.0;" &_
"Data Source = "&Path&";" &_
"Persist Security Info = FALSE"
oConn.Open dbConn
set conntemp=server.createobject("adodb.connection")
conntemp.open oConn
set rstemp=conntemp.execute(sQuery, sAction)
If NOT(rstemp.eof) then 'recordset has rows
'build a table %>
<form action="as_docon.asp" method="post">
<input type="hidden" name="sAction" value="<%= sAction %>" />
<table border="1" cellpadding="3" cellspacing="3"
summary="mytable"><%
howmany=rstemp.fields.count
lastrecord=howmany-1
response.write "<tr>"
while rstemp.eof=false
for i=1 to howmany-1
if i=lastrecord then
response.write ("<td><input type=""radio"" name=""" &
rstemp(i).name & """ value=" & rstemp(i) & "></td>")
response.write "</tr><tr>"
else
response.write ("<td>" & rstemp(i) & "</td>")
end if
next
rstemp.movenext
wend
response.write "<td align=""right"" colspan=" & lastrecord & "><input
type=""submit"" name=""submit"" value=""Go""></td></tr></table></form>"
else
response.write "<p>The page encountered an error. Please contact the
system administrator.<p>"
end if
rstemp.close
set rstemp=nothing
conntemp.close
set conntemp=nothing
end sub %>
my asp/html table leaves out the table header and column headers. w, your
script sounds like mine
but you put the column headers in the access table. I can do that. What do
you do about the table header?
Also a lot of my tables have associated informtion that describes how to use
the table.
So, it's a simple thing but I wondered if there was some nicer way than
hardcoding the table
heading and such. Thanks for the replies!
More information about the thelist
mailing list