当前位置: 技术问答>java相关
stmt.executeUpdate(s);yhxm 插入的是乱码????
来源: 互联网 发布时间:2015-05-11
本文导语: String s=new String(); s="update tCJ_YHXX set yhid='"+yhid+"',yhxm='"+yhxm+"' where yhid='"+old_yhid+"'"; Statement stmt=con.createStatement();//java.sql.ResultSet.TYPE_SCROLL_INSENSITIVE,java.sql.ResultSet.CONCUR_READ_ONLY); out.print(s); stmt.executeUpdate(s); } ...
String s=new String();
s="update tCJ_YHXX set yhid='"+yhid+"',yhxm='"+yhxm+"' where yhid='"+old_yhid+"'";
Statement stmt=con.createStatement();//java.sql.ResultSet.TYPE_SCROLL_INSENSITIVE,java.sql.ResultSet.CONCUR_READ_ONLY);
out.print(s);
stmt.executeUpdate(s);
}
catch(Exception e){
System.err.println("aq.executeQuery: " + e.getMessage());
}
// response.sendRedirect("local_admin.jsp");
------------------------------------------
out.print(s);==写出是正确的
update tCJ_YHXX set yhid='operator',yhxm='理用户 理用户 ' where yhid='operator'
stmt.executeUpdate(s);yhxm 插入的是乱码????
s="update tCJ_YHXX set yhid='"+yhid+"',yhxm='"+yhxm+"' where yhid='"+old_yhid+"'";
Statement stmt=con.createStatement();//java.sql.ResultSet.TYPE_SCROLL_INSENSITIVE,java.sql.ResultSet.CONCUR_READ_ONLY);
out.print(s);
stmt.executeUpdate(s);
}
catch(Exception e){
System.err.println("aq.executeQuery: " + e.getMessage());
}
// response.sendRedirect("local_admin.jsp");
------------------------------------------
out.print(s);==写出是正确的
update tCJ_YHXX set yhid='operator',yhxm='理用户 理用户 ' where yhid='operator'
stmt.executeUpdate(s);yhxm 插入的是乱码????
|
是你中文的问题!
|
public class getStr(String str)
{ String str;
byte[] str1=new String(str.getBytes,"8859_1");
return str1;
}
把含有中文的 用getStr(string) 来插入
{ String str;
byte[] str1=new String(str.getBytes,"8859_1");
return str1;
}
把含有中文的 用getStr(string) 来插入