java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] 语法错误 (操作符丢失)
<%Class.forName( "sun.jdbc.odbc.JdbcOdbcDriver ");
String url= "jdbc:odbc:email ";
String user= " ";
String pwd= " ";
Connection con=DriverManager.getConnection(url,user,pwd);
Statement stmt=con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_READ_ONLY);
%>
<%
String sql1= "select id from email ";
ResultSet rs=stmt.executeQuery(sql1);
rs.last();
id=rs.getRow();
%>
<%
String sql= "insert into email values( "+id+ ", "+name1+ ", "+name2+ ", "+name3+ ") ";
stmt.executeUpdate(sql);
%>
------解决方法--------------------------------------------------------
String sql= "insert into email values( "+id+ ", "+name1+ ", "+name2+ ", "+name3+ ") ";
----------------------------
String sql= "insert into email values( ' "+id+ " ', ' "+name1+ " ', ' "+name2+ " ', ' "+name3+ " ') ";
------解决方法--------------------------------------------------------
单引号注意! print出来看看! 发了两个?