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

大家帮帮看看那里的问题?
我想将数据库的一个表里的数据存到另一个表里,语言JSP,数据库为SQL2000
代码:
<%
String   sqlString= "update     monTable   set   monTable.sort_number=qicaiTable.sort_number,monTable.e_name=qicaiTable.e_name,
  monTable.e_size=qicaiTable.e_size,monTable.unit=qicaiTable.unit,monTable.endm=qicaiTable.amount   from   monTable,qicaiTable "   ;
  try  
        {   Connection   con;
            Statement   sql;
            Class.forName( "com.microsoft.jdbc.sqlserver.SQLServerDriver ");
            con=DriverManager.getConnection( "jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=shangdianDB ", "sa ", " ");
            sql=con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_READ_ONLY);
            sql.executeUpdate(sqlString);
    con.close();
      }
  catch(SQLException   e1)  
        {
            out.print(e1);
        }
  %>  


提示出错,  
An   error   occurred   at   line:   10   in   the   jsp   file:   /shd/stat/mon.jsp
Generated   servlet   error:
String   literal   is   not   properly   closed   by   a   double-quote


org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:510)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:375)
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)


小弟初学,请大家指点下,谢谢了!

------解决方案--------------------
String sqlString= "update monTable set monTable.sort_number=qicaiTable.sort_number,monTable.e_name=qicaiTable.e_name,
monTable.e_size=qicaiTable.e_size,monTable.unit=qicaiTable.unit,monTable.endm=qicaiTable.amount from monTable,qicaiTable " ;

---------------------------------------------
String sqlString= "update monTable set " + "monTable.sort_number=qicaiTable.sort_number,monTable.e_name=qicaiTable.e_name, "
+ "monTable.e_size=qicaiTable.e_size,monTable.unit=qicaiTable.unit, "
+ "monTable.endm=qicaiTable.amount from monTable,qicaiTable " ;