......................
try{
Statement st=getStatement();
String name=request.getParameter("name");
String sex=request.getParameter("sex");
String age=request.getParameter("age");
switch(type){
case 0:
rs=st.executeQuery("select * from t1");
break;
......................
case 4:
name=new String(name.getBytes("ISO-8859-1"));
sex=new String(sex.getBytes("ISO-8859-1"));
String sql="update t1 set sex='"+sex+"',age='"+age+"' where name='"+name+"'";
st.executeQuery(sql);
response.sendRedirect("friend.jsp");
break;
.......................
这一条语句不能实现:String sql="update t1 set sex='"+sex+"',age='"+age+"' where name='"+name+"'";
即修改功能不能实现!报错为:java.sql.SQLException: Can not issue data manipulation statements with executeQuery().