package com.company; import java.sql.*; /** * Created by ttc on 16-11-1. */ public class Insert { public static void insertUser(UserInfo ui) throws ClassNotFoundException, SQLException { Connection con = DbUtils.getConnection(); String strSql = "INSERT INTO userinfo VALUES (seq_userinfo.nextval,?,?)"; PreparedStatement ps = con.prepareStatement(strSql); ps.setString(1,ui.getUsername()); ps.setString(2,ui.getUserpass()); ps.executeUpdate(); DbUtils.close(con,ps); } }
1101学习记录!!!一定切记,executeUpdate后面括号中不要添加strSql
最新推荐文章于 2021-06-18 15:10:11 发布