MySQL语句执行有关问题,在线
MySQL语句执行问题,在线求助!
下面是执行
异常是 Unknown column '这里是乱码' in 'field list' 这里的乱码不是csdn的转码问题,另外,我的字符集和mysql的表字符集都是utf - 8,这个到底是怎么回事,请助!!在线等。
------解决方案--------------------
接分。嘻嘻。
String tempUserInformation = null;
// 获取myslq的statement对象
Statement statement = DBStatmentFactory.getStatment();
/**
* 生成sql语句
*/
StringBuilder CompleteSelfInformation = new StringBuilder(
"update UserSelfInformation set");
// 添加名字插入信息
if ((tempUserInformation = userInformationDoc.getRootElement()
.getChildText("userName")) != null) {
CompleteSelfInformation.append(" userName = " + tempUserInformation
+ " ,");
System.out.println(tempUserInformation);
}
下面是执行
// 处理语句
CompleteSelfInformation.delete(CompleteSelfInformation.length() - 1,
CompleteSelfInformation.length());
CompleteSelfInformation.append("where id = " + userID);
System.out.println(CompleteSelfInformation.toString().trim());
/**
* 执行sql语句
*/
try {
statement.execute(CompleteSelfInformation.toString().trim());
} catch (SQLException e) {
System.out.println("没有修改成功!------------需要反馈到客户端没有修改成功");
e.printStackTrace();
}
/**
* 释放相关链接资源
*/
ReleaseResource.releaseConnectAndStatement(statement);
异常是 Unknown column '这里是乱码' in 'field list' 这里的乱码不是csdn的转码问题,另外,我的字符集和mysql的表字符集都是utf - 8,这个到底是怎么回事,请助!!在线等。
mysql
乱码
stringbuilder
------解决方案--------------------
接分。嘻嘻。