📜  jdbc 从输入值插入示例 - Java 代码示例

📅  最后修改于: 2022-03-11 14:52:24.686000             🧑  作者: Mango

代码示例2
// 2. Create a statement
    String sql = "insert into employees "
            + " (last_name, first_name)" + " values (?, ?)";
    myStmt = myConn.prepareStatement(sql);
    // set param values
    myStmt.setString(1, lastName);
    myStmt.setString(2, firstName);
    // 3. Execute SQL query
    myStmt.executeUpdate();