listemployees.ctf

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

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

    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 until resultSet.next() = 0
        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()
%>






