<%@ page import = "java.sql.*" %> Law Computing Support

Law Computing Support

back to LCS home

Printing

Printing

How do I know how much printing credit I have left?

Just enter your lab username in the box below (e.g., "jsmith"), then press the "Get Print Credit" button.  You will then be shown the number of pages of printing you have left.

<% String user = request.getParameter("userName"); if (user == null) { %>
<% } else { int UserId=0; String strUser = ""; String pages=""; try { String UserStatement = "SELECT user_id FROM people WHERE id ='" + user + "'"; String PrintStatement = "SELECT convert(int, (user_purse + tuition_purse + technology_purse) * 33) AS pages FROM people_balances WHERE user_id ="; Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver"); Connection con = DriverManager.getConnection("jdbc:microsoft:sqlserver://athens:1433;DatabaseName=pharos", "sa", "einstein"); Statement stmt = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); ResultSet rs = stmt.executeQuery(UserStatement); rs.first(); UserId= rs.getInt("user_id"); rs.close(); ResultSet rs2 = stmt.executeQuery(PrintStatement + UserId); rs2.first(); pages=rs2.getString("pages"); out.println("

You have " + pages + " pages left.

"); rs2.close(); } catch (Exception e) { %>
<% } } %>

The same information can also be found on the Law Computing Support home page.

Last update: 12/02/2004
© 2002 Pepperdine University School of Law
To help us improve our content, please provide your feedback below.
Was this information helpful? Very Somewhat No
Was the information on this page accurate? Very Somewhat No
Were the steps easy to follow? Very Somewhat No
Was the information complete? Yes No
Additional Information:
Name or Email Address optional: