1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
   |  
public static final String REQUETE = "SELECT"
			+" SUM(AMOUNT) AS AMOUNT, DOC_TYPE_DESC, FINANCIAL_TRANSACTIONS.ACCOUNT_ID, DOC_DATE"
			+" FROM FINANCIAL_TRANSACTIONS"
			+" INNER JOIN FINANCIAL_ACCOUNT"
			+" ON FINANCIAL_TRANSACTIONS.ACCOUNT_ID=FINANCIAL_ACCOUNT.ACCOUNT_ID"
			+" GROUP BY DOC_TYPE_DESC, FINANCIAL_TRANSACTIONS.ACCOUNT_ID, DOC_DATE"
			+" ORDER BY DOC_DATE, FINANCIAL_TRANSACTIONS.ACCOUNT_ID, DOC_TYPE_DESC";
 
public static final String EURO = "EUR";
 
static {
	try {
		DriverManager.registerDriver(new SQLServerDriver());
	} catch (SQLException e) {
		e.printStackTrace();
	}
}
 
%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>TP5</title>
</head>
<body>
 
 
<table border='1'>
	<thead>
		<tr>
			<th><b>Date</b></th>
			<th><b>Compte</b></th>
			<th><b>Description</b></th>
			<th><b>Montant</b></th>
		</tr>
	</thead>
	<tbody>
<%
                Connection connexion = DriverManager.getConnection(URL, USAGER, MOT_DE_PASSE);
                Statement énoncé = connexion.createStatement();
                ResultSet résultat = énoncé.executeQuery(REQUETE);
        
                NumberFormat nf = DecimalFormat.getCurrencyInstance(Locale.CANADA_FRENCH);
        
                while (résultat.next()) {
%>
			<tr>
					<td><b><%= résultat.getObject(4) %></b></td>
						<td><%= résultat.getObject(3) %></td>
						<td><%= résultat.getObject(2) %></td>
						<td><%= résultat.getObject(1) %></td>
 
			</tr>
 
<%
                }
                résultat.close();
                énoncé.close();
                connexion.close();
%>
	</tbody>
</table>
 
 
</body>
</html> | 
Partager