日期:2014-05-18  浏览次数:20680 次

高分求助!!!sql语句问题!
jsp如下,我的javabean没问题!
<%@   page   contentType= "text/html;   charset=gb2312 "   language= "java "   import= "java.sql.* "   errorPage= " "   %>
<%@   include   file= "../include/set_china.jsp "%>
<jsp:useBean   id= "query "   class= "login.QueryBean "   scope= "page ">
</jsp:useBean>
<!DOCTYPE   html   PUBLIC   "-//W3C//DTD   XHTML   1.0   Transitional//EN "   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
<html   xmlns= "http://www.w3.org/1999/xhtml ">
<head>
<link   href= "../include/css.css "   rel= "stylesheet "   type= "text/css "   />
<meta   http-equiv= "Content-Type "   content= "text/html;   charset=gb2312 "   />
<title> 无标题文档 </title>
</head>

<body>
<%
    ResultSet   rs=null;
String   sql= "select   a.txtnumber,   a.txtname,b.course_name,b.course_mark,c.s_result   from   student_info   as   a   join   choose_course   as   c   on   a.txtnumber=c.student_id   join   course_info   as   b   on   c.s_course_id=b.course_id   where   a.txtnumber= '0467110054 ' ";
    //String   sql= "select     *   from   student_info ";
try
    {
        //设置连接
String   url= "jdbc:odbc:jwzx ";
        query.setConnection( "sun.jdbc.odbc.JdbcOdbcDriver ",url, " ", " ");
        //设置SQL语句
        query.setQuerystatement(sql);
        //得到查询结果
        rs=query.getResult();
    }
    catch(SQLException   e1)  
    {
        out.print(e1);
}
while(rs.next())
{
out.print(rs.getString(1));
out.print(rs.getString(2));
}
%>
我把数据库导入sql后select   a.txtnumber,   a.txtname,b.course_name,b.course_mark,c.s_result   from   student_info   as   a   join   choose_course   as   c   on   a.txtnumber=c.student_id   join   course_info   as   b   on   c.s_course_id=b.course_id   where   a.txtnumber= '0467110054 '此语句正确!但是在jsp中就报错!我把sql改为String   sql= "select     *   from   student_info ";后就正确!迷茫中!
错误提示:
HTTP   Status   500   -  

--------------------------------------------

type   Exception   report

message  

description   The   server   encountered   an   internal   error   ()   that   prevented   it   from   fulfilling   this   request.

exception  

org.apache.jasper.JasperException:   An   exception   occurred   processing   JSP   page   /My_jwzx/student/