往数据库插入一个数据

String sql="Insert into haas1(id,name,major) values('101','hz','电信')";
PreparedStatement pstmt=conn.prepareStatement(sql);

int n=pstmt.executeUpdate();
if(n==1){%>数据插入操作成功!<br><%}
else{%>数据插入失败!<br><%}


if(pstmt!=null){pstmt.close();}
if(conn!=null){conn.close();}%>

posted @ 2017-10-20 12:01  为PG1打call  阅读(534)  评论(0编辑  收藏  举报