rodsdot.com :: generic database page - states table
| AL | Alabama |
| AK | Alaska |
| AZ | Arizona |
| AR | Arkansas |
| CA | California |
| CO | Colorado |
| CT | Connecticut |
| DE | Delaware |
| DC | District Of Columbia |
| FL | Florida |
| GA | Georgia |
| HI | Hawaii |
| ID | Idaho |
| IL | Illinois |
| IN | Indiana |
| IA | Iowa |
| KS | Kansas |
| KY | Kentucky |
| LA | Louisiana |
| ME | Maine |
| MD | Maryland |
| MA | Massachusetts |
| MI | Michigan |
| MN | Minnesota |
| MS | Mississippi |
| MO | Missouri |
| MT | Montana |
| NE | Nebraska |
| NV | Nevada |
| NH | New Hampshire |
| NJ | New Jersey |
| NM | New Mexico |
| NY | New York |
| NC | North Carolina |
| ND | North Dakota |
| OH | Ohio |
| OK | Oklahoma |
| OR | Oregon |
| PA | Pennsylvania |
| PR | Puerto Rico |
| RI | Rhode Island |
| SC | South Carolina |
| SD | South Dakota |
| TN | Tennessee |
| TX | Texas |
| UT | Utah |
| VT | Vermont |
| VI | Virgin Islands |
| VA | Virginia |
| WA | Washington |
| WV | West Virginia |
| WI | Wisconsin |
| WY | Wyoming |
Code
<%
Option Explicit
Dim rs, conn, command, connection, tableHTML
command = "SELECT Code, Description FROM states ORDER BY Description;"
Set conn = Server.CreateObject("ADODB.Connection")
connection = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source='C:\path\to\database\examples.mdb'"
conn.open connection
Set rs = Server.CreateObject("ADODB.RecordSet")
rs.open command, conn, 3, 1, 1
if NOT (rs.bof AND rs.eof) then
tableHTML = "<table id=""statesTable"">"
while NOT rs.eof
tableHTML = tableHTML & "<tr><td>" & rs("Code") & "</td><td>" & rs("Description") & "</td></tr>"
rs.movenext
wend
rs.close
Set rs = nothing
tableHTML = tableHTML & "</table>"
end if
conn.close
Set conn=nothing
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<title>rodsdot.com :: generic database page - states table</title>
</head>
<body>
<%=tableHTML%>
</table>
</body>
</html>