当前位置: 代码迷 >> Java Web开发 >> java.sql.SQLException: [Microsoft][SQLServer JDBC Driver]Unexpected token type: ERROR解决思路
  详细解决方案

java.sql.SQLException: [Microsoft][SQLServer JDBC Driver]Unexpected token type: ERROR解决思路

热度:569   发布时间:2016-04-17 16:47:32.0
java.sql.SQLException: [Microsoft][SQLServer JDBC Driver]Unexpected token type: ERROR
我的javaBean代码如下:
package   chdetailPac;
import   java.sql.*;
import   DB.connection;
import   java.lang.*;
public   class   getDetail
{
connection   con;
public   getDetail()
{
con=new   connection();

}    
    public   ResultSet   getDetailInfo(String   strType)
{
      strType= "select   insInfo.*   from   insInfo   ,ins,minor   where   insInfo.insName=ins.insName   and   ins.ID=minor.ID   and   minor.ID= "+strType+ " ";
return   con.executeQuery(strType);  
}
}
jsp代码:
<%  
      String   id=new   String(request.getParameter( "id ").getBytes( "ISO-8859-1 "), "gb2312 ");
      ResultSet   rs=getDetail.getDetailInfo(id);
      rs.next();
%>
在运行过程中出现了错误:
java.sql.SQLException:   [Microsoft][SQLServer   JDBC   Driver]Unexpected   token   type:   ERROR
com.microsoft.jdbc.base.BaseExceptions.getException(Unknown   Source)
com.microsoft.jdbc.sqlserver.tds.TDSRequest.getRow(Unknown   Source)
com.microsoft.jdbc.sqlserver.SQLServerImplResultSet.positionCursor(Unknown   Source)
com.microsoft.jdbc.base.BaseResultSet.next(Unknown   Source)
org.apache.jsp.chsubDetail_jsp._jspService(chsubDetail_jsp.java:66)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:332)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

请各位高手帮帮忙,以前我在ACCESS数据库中就可以运行,但转到SQL   server就出现了问题,我运行其它的SQL语句都可以   ,应该不是驱动的问题了。

------解决方案--------------------
你参数的名字和你的sql語句的變量同名了,能不錯嗎?
把參數換個名字.
------解决方案--------------------
呵呵
  相关解决方案