Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
 public void Accountdetails(HttpServletResponse res,String login) throws IOException
    {
    	//connection to DCU
    	Connection con=null;
    	con=Connect();
 
    	//initialization
    	Statement stmt = null;
        ResultSet rs = null;
 
        try{
        	 PrintWriter out = res.getWriter();
        	stmt = con.createStatement();
        	out.println("login into accountdetails ="+login);
    	    rs = stmt.executeQuery("SELECT A.NAME,A.BALANCE,A.OVERDRAFT " +
    	    		"FROM ACCOUNTS123 A,USERS123 U "+
    	    		"WHERE A.USER_ID=U.ID "+
    	    		"AND U.LOGIN='"+login+"'"); 
 
 
    	     //out.println("<script language='Javascript1.2'>");
    	    //out.println("function submit() {var form = document.AccountForm;");	
    	    //out.println("form.submit();}");	
    	    //out.println("</script>}");
 
 
    	    out.println("<TR><TD><FORM name ='AccountForm' action=http://localhost:8080/OnlineBankingSystem/servlet/account_2 method='POST' >");
 
    	    while (rs.next())
    	    	{
		           // out.println("<TR><TD><A HREF='http://localhost:8080/OnlineBankingSystem/servlet/account_2'>"+rs.getString("NAME")+"</A>");
    	    	out.println("<input type='hidden' name='NUMBER' value='"+rs.getString("ACCOUNT_NUMBER")+"'>");
    	    	out.println("<input type='hidden' name='NAME' value='"+rs.getString("NAME")+"'>");
    	    	out.println("<input type='submit' value='"+rs.getString("NAME")+"'></TD>");
    	    		//<TR><TD>Your accounts</TD><TD>balance</TD><TD>overdraft limit</TD></TR>
		          //  out.println("<TR><TD><A HREF=http://localhost:8080/OnlineBankingSystem/servlet/account_2?var="+rs.getString("NAME")+">"+rs.getString("NAME")+"</A></TD>");
		            out.println("<TD>"+rs.getString("BALANCE")+"</TD>");
		            out.println("<TD>"+rs.getString("OVERDRAFT")+"</TD></TR>");
 
 
    	    	}	
 
    	    	deconnect(stmt,rs,con);
 
    	    }
            catch (SQLException e) {
    	     System.out.println("\nAn error has occurred during the Statement/ResultSet phase.  Please check the syntax and study the Exception details!");
                while (e != null) {
    	         System.out.println(e.getMessage());
                    e = e.getNextException();
    	     }
                //System.exit(0);
            }
 
    }
une SQL Exception e survient lorsque j'execute mon programme alors qu'il y 20 minutes ce SQL query marcahait parfaitement . Ce SQL query s'executait bien jusqu'a mainteant. J'ai change quelaues balises html dans le while c'est tout. Donc je coince ...

[quote]
Connecting to the SSD Database......

Connection Successful..... creating statement....

An error has occurred during the Statement/ResultSet phase. Please check the syntax and study the Exception details!
Invalid column name

[quote]

j'ai verifier ma database et rien n'a ete modifier, j'ai reexcute le query
avec SQL tool et ma requete marche donc ?????