<html>
<head>
<title>listemployees Source</title>
</head>
<body>
<plaintext>
listemployees.ctf

#!/bin/sh /ss/bin/ss.exe
<%
    loadDriver("sun.jdbc.odbc.JdbcOdbcDriver")

    connection = getConnection("jdbc:odbc:iob", "", "")

    statement = connection.createStatement()
    resultSet = statement.executeQuery("select * from employees")

    count = 0
%>
<html>
    <head>
        <title>List Employees</title>
    </head>
    <body>
        <table cellpadding=5 cellspacing=0 border=1>
            <tr>
                <th>
                    First Name
                </th>
                <th>
                    Last Name
                </th>
            </tr>
<%
    do while resultSet.next()
        count = count + 1
%>
            <tr>
                <td>
                    <%=resultSet.getString("FirstName")%>
                </td>
                <td>
                    <%=resultSet.getString("LastName")%>
                </td>
            </tr>
    <%loop%>

        </table>

    <%if count = 0 then%>
        <p>
        no employees were displayed
    <%elseif count = 1 then%>
        <p>
        one employee was displayed
    <%else%>
        <p>
         <%=count%> employees were displayed
    <%end%>
    </body>
</html>
<%
    resultSet.close()
    statement.close()
    connection.close()
%>

