日期:2014-05-20 浏览次数:20757 次
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);