IIS 7.0, Classic ASP and Access 2007.

Tags: Access2007

I’m having too much fun thinking of the old days of Classic ASP.  Here is an example of using a Classic ASP page along with IIS 7.0 and Access 2007.  PS: The example shows how to get it working, it’s not meant to be production ready, you should add error coding to block sql injection attacks and other ‘bad’ things that can happen. 

Here is the sample code.
Download here

<%
‘ create conn as adodb.connection and open it
dim strconn
dim conn
dim rs

strconn = “Provider=Microsoft.ACE.OLEDB.12.0;Data Source=” & Server.MapPath(“App_Dataauthors.accdb”)
set conn = server.createobject(“adodb.connection”)
conn.open strconn
sql = “select * from Authors”
set rs = conn.execute(sql)

%>
<html>
<head><title></title>
</head>
<body>
<table border=”1″>
<%
do while not rs.eof
    response.write “<tr><td><b>” & rs(“Field1”) & “</td><td>” & rs(“Field2”) & “<td></tr>”
    rs.movenext
loop

conn.close
Set conn = nothing
set rs = nothing

%>
</table>
</body>
</html>

1 Comment

Add a Comment