<%
' this code opens the database
myDSN="DSN=Student;uid=student;pwd=magic"
set conntemp=server.createobject("adodb.connection")
conntemp.open myDSN
' this code retrieves the data
mySQL="select * from publishers where state='NY'"
set rstemp=conntemp.execute(mySQL)
' this code detects if data is empty
If rstemp.eof then
response.write "No records matched
"
response.write mySQL & "
So cannot make table..."
connection.close
set connection=nothing
response.end
end if
%>
<%
' This code puts fieldnames into column headings
response.write ""
for each whatever in rstemp.fields
response.write "| " & whatever.name & " | "
next
response.write "
"
' Now lets grab all the records
DO UNTIL rstemp.eof
' put fields into variables
pubid=rstemp("pubid")
name=rstemp("name")
company_name=rstemp("company name")
address=rstemp("address")
city=rstemp("city")
state=rstemp("state")
zip=rstemp("zip")
telephone=rstemp("telephone")
fax=rstemp("fax")
comments=rstemp("comments")
' write the fields to browser
cellstart=""
response.write " | "
response.write cellstart & pubid & ""
response.write cellstart & name & ""
response.write cellstart & company_name & ""
response.write cellstart & address & ""
response.write cellstart & city & ""
response.write cellstart & state & ""
response.write cellstart & zip & ""
response.write cellstart & telephone & ""
response.write cellstart & fax & ""
response.write cellstart & comments & ""
response.write "
"
rstemp.movenext
LOOP
%>
<%
' Now close and dispose of resources
rstemp.close
set rstemp=nothing
conntemp.close
set conntemp=nothing
%>