|
楼主 |
发表于 2020-10-14 20:15:01
|
显示全部楼层
好了上边的问题也解决了
可为什么
我插入数据库老是空呢
我用他进行了数据的插入
try {
System.out.println("ejbCreate()方法被调用");
con = getConnection();
String sqlStr = "insert into UserIfometion(UserName,Userpwd,"
+ "RealName,sex,UserItrduce)"
+ " values (?,?,?,?,?)";
pstmt = con.prepareStatement(sqlStr);
pstmt.setString(1, username);
pstmt.setString(2, userpwd);
pstmt.setString(3, realname);
pstmt.setString(4, sex);
pstmt.setString(5, useritrduce);
System.out.println(sqlStr);
System.out.println("888888888888888888888888888888888888844哦");
pstmt.executeUpdate();
pstmt.execute();
System.out.println(username);
System.out.println(userpwd);
System.out.println(realname);
System.out.println(sex);
System.out.println(useritrduce);
System.out.println("dhhhhhhhhhhhhhhhhhddddddddddd哦");
return null;
} catch (Exception e) {
throw new CreateException(e.toString());
} finally {
try {
if (pstmt != null) {
pstmt.close();
}
} catch (Exception e) {
e.printStackTrace();
}
try {
if (con != null) {
con.close();
}
} catch (Exception e) {
e.printStackTrace();
}
}
下边是测试端的
try{
home.create("杨涌旗","66113576","栀子花开","男","TNND");
}catch(Exception e){}
我能显示 测试端的值 但是 插不进去
可我有个自增的字段他的值却是在变化的
TNND |
|