<%@ Language=VBScript %>
<% Option Explicit %>
<!--#include virtual="/mst3k/adovbs.inc"-->

<html>
<head>
<title>Select an Employee</title>
</head>
<body>

<%
' make a database connection
Dim myDBConnection
Dim myDriverInfo

Set myDBConnection = Server.CreateObject("ADODB.Connection")
myDriverInfo = _

"Provider=Microsoft.Jet.OLEDB.4.0;" _
    & "Data Source=f:\web\database\mst3k\Inventory.mdb"

myDBConnection.Open myDriverInfo

'Instantiate an ADO Recordset object
Dim employeeList
Set employeeList = _

Server.CreateObject("ADODB.Recordset")

employeeList.ActiveConnection = myDriverInfo
employeeList.CursorType = adOpenStatic

Dim SQLQuery
SQLQuery = _

"Select * FROM Employees ORDER BY LastName, FirstName"

employeeList.open SQLQuery
%>

<table cellpadding=5 bgcolor=lightgrey>
<tr>
<td><font face="Verdana, Arial, Helvetica, sans-serif">
<b>Select an employee:</b></font>
</td>
</tr>
</table>
<p>
<ul>

<%
' Use the EOF property to loop through the records in the recordset
' make each listing a bulleted item and a hyperlink to the
' corresponding recordeset of listresults.asp

Do While Not employeeList.EOF

Response.Write "<li><font face='Verdana, Arial, Helvetica, sans-serif' size='-1'>" _
    & "<a href='listresults.asp?FormEmployeeID=" & employeeList("EmployeeID") & "'>" _
    & employeeList("FirstName") & " " & employeeList("LastName") & "</a></font></li>"
employeeList.MoveNext

Loop

' Close everything and release the memory consumed by the objects
employeeList.Close
Set employeeList = Nothing
myDBConnection.Close
Set myDBConnection = Nothing
%>

</ul>
</body>
</html>