userdao.java
来自「中国移动管理系统」· Java 代码 · 共 40 行
JAVA
40 行
package com.chinamobile.dao;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import com.chinamobile.bean.AccountBean;
import com.chinamobile.bean.UserBean;
public class UserDAO {
public void addNewUser(UserBean user){
String find = "insert into TUser(Mobile_Number,Roaming_Status,Com_Level,Customer_ID,Account_ID) values(?,?,?,?,?)";
UserBean account = null;
SQLServerDAOFactory dao = new SQLServerDAOFactory();
Connection conn = dao.getConnection();
PreparedStatement pstmt = null;
try {
pstmt = conn.prepareStatement(find);
pstmt.setString(1, user.getMobile_Number());
pstmt.setString(2, user.getRoaming_Status());
pstmt.setString(3, user.getCom_Level());
pstmt.setString(4, user.getCustomer_ID());
pstmt.setString(5, user.getAccount_ID());
pstmt.execute();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} finally {
dao.closeConnection(conn);
dao.closeStatement(pstmt);
}
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?