<%
' ASP program that displays a database in table form
myDSN="DSN=Student;uid=student;pwd=magic"
mySQL="select * from publishers where state='NY'"
showblank=" "
shownull="-null-"
set conntemp=server.createobject("adodb.connection")
conntemp.open myDSN
set rstemp=conntemp.execute(mySQL)
If rstemp.eof then
response.write "No records matched
"
response.write mySQL & "
So cannot make table..."
conntemp.close
set conntemp=nothing
response.end
end if
%>
<% 'Put Headings On The Table of Field Names
for each whatever in rstemp.fields%>
| <%=whatever.name%> |
<% next %>
<% ' Now lets grab all the records
DO UNTIL rstemp.eof %>
<% for each whatever in rstemp.fields
thisfield=whatever.value
if isnull(thisfield) then
thisfield=shownull
end if
if trim(thisfield)="" then
thisfield=showblank
end if%>
| <%=thisfield%>
|
<% next %>
<%rstemp.movenext
LOOP%>
<%
rstemp.close
set rstemp=nothing
conntemp.close
set conntemp=nothing
%>