PreparedStatement的使用:
conn = DriverManager.getConnection("jdbc:mysql://localhost/mydata?" + "user=root&password=root"); pstmt = conn.prepareStatement("insert into dept values (?,?,?)"); pstmt.setInt(1,deptno); pstmt.setString(2,dname); pstmt.setString(3,loc); pstmt.executeUpdate();
时间: 2024-10-10 00:13:04