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

java.sql.SQLException: [Microsoft][ODBC SQL Server Driver][SQL Server]'FORM' 附近有语法错误。
jsp页面运行后出现以下页面这种情况,是什么问题,怎么解决?

java.sql.SQLException: [Microsoft][ODBC SQL Server Driver][SQL Server]'FORM' 附近有语法错误。 

  所运行的jsp内容是:


<%@ page contentType="text/html;charset=gb2312" %>
<%@ page import="java.sql.*" %>
<html><body bgcolor=cyan>
<% Connection con;
  Statement sql;
  ResultSet rs;
  try{ Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
}
  catch(ClassNotFoundException e)
{ out.print(e);
}
  try{ con=DriverManager.getConnection("jdbc:odbc:mymoon","","");
sql=con.createStatement();
rs=sql.executeQuery("SELECT * FORM employee WHERE salary>3000");
out.print("<table border=2>");
out.print("<tr>");
out.print("<th width=100>"+"雇员号");
out.print("<th width=100>"+"姓名");
out.print("<th width=50>"+"出生日期");
out.print("<th width=50>"+"薪水");
out.print("</tr>");
  while(rs.next())
{ out.print("<tr>");
out.print("<td>"+rs.getString(1)+"</td>");
out.print("<td>"+rs.getString(2)+"</td>");
out.print("<td>"+rs.getDate("birthday")+"</td>");
out.print("<td>"+rs.getFloat("salary")+"</td>");
out.print("</tr>");
}
out.print("</table>");
con.close();
  }
  catch(SQLException e)
{ out.print(e);
}
%>
</body></html>

------解决方案--------------------
sql语句写错了吧?关键字from,LZ写成form 了
------解决方案--------------------
谢谢!
------解决方案--------------------
action地址写错了吧?
url pattern是/test