<html>
<head> 
<title>Connecting to an Access database</title> </head> 
<body> 

<% 
	SET myConn=SERVER.createobject("adodb.connection")
	DBpath=SERVER.MapPath("_private") 
	strConn="PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=" 
	strConn=strConn & DBpath 
	strConn=strConn & "\Employees.mdb;" 

	myConn.Open (strConn) 
	SQLStr="SELECT Empno, ename, deptno FROM Emp ORDER BY deptno, ename"

	SET result=myConn.execute(SQLStr) 
	
	IF NOT result.EOF thEN 
		response.write("<h2>Second ASP Example</h2>") 
		response.write("<p>Connecting to an Access Database</p>")
		response.write("<table border=3 bgcolor=#0099CC><tr><th>Employee No</th><th>Name</th><th>Department No</th>")

		WHILE NOT result.EOF 
			response.write("<tr><td>" & result("empno") & "</td>") 
			response.write("<td>" & result("ename") & "</td>") 
			response.write("<td>" & result("deptno") & "</td></tr>") 
			result.movenext() 

		WEND 
		response.write("</table>") 

	ELSE 
		response.write("<p>Error retrieving Employee data!!</p>") 
	END IF 
%> 

</body>
</html>