hi im new to tomcat. im having trouble using jsp pages to query my microsoft sql server 2000. does anyone know how to do this? i've followed the microsoft instructions but it doens't work still. i created the CLASSPATH environement variables, but my jsp code looks like it doens't work


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <%@ page import="java.sql.*, java.util.*" errorPage="error.jsp" %>


<html> <head> <title>Current Election Results:</title> </head>

<body>

<h2>Here are the latest voting results... </h2>

<%
Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");
Connection con = DriverManager.getConnection("jdbc:microsoft:sqlserver://128.91.107.105:1433;User=sa;Password=duder");


   Statement stmt = con.createStatement();
   String queryStr = "SELECT username FROM player";
   ResultSet rs = stmt.executeQuery(queryStr);
%>
<table border="0" cellspacing="0" cellpadding="2">
<tr bgcolor="lightgrey">
<th align="left">Candidate</th>
<th align="right">Total Votes</th>
</tr>

<%  while (rs.next()) {
     String firstname = rs.getString(1);

%>

<tr>
<td><%= firstname %> </td>
<td align="right">dfd</td>
</tr>
<%
   }  // end while()

   // clean up.
   if (rs!=null) rs.close();
   if (stmt!=null) stmt.close();
   if (con!=null) con.close();
%>
</table>
</body>
</html>




_________________________________________________________________
MSN 8 with e-mail virus protection service: 2 months FREE* http://join.msn.com/?page=features/virus



--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to