连接数据库问题
public void insert(User user) throws Exception {//增加操作
// TODO Auto-generated method stub
String sql = " insert into luser_tbl(name,password,age) values('?','?','?')";
PreparedStatement pstmt=null;
DataBaseConnection dbc=null;
dbc=new DataBaseConnection();
pstmt=dbc.preparestatement(sql);//这条语句报错要如何解决?提示找不到方法pstmt.setString(1, user.getName());
pstmt.setString(2, user.getPassword());
pstmt.setInt(3, user.getAge());
pstmt.execute();
[解决办法]
String sql = " insert into luser_tbl(name,password,age) values('?','?','?')";
改成
String sql = " insert into luser_tbl(name,password,age) values(?,?,?)";
[解决办法]