方法1:
Connection connection=Connector.getConnection();
PreparedStatement ps1=connection.prepareStatement("insert into tbl_invtry(part_id,part_name)
values(?,?,)");
ps1.setString(1,action.getPart_id());
ps1.setString(2,action.getPart_name());
方法2:
DAO dao = new DAOImpl(); //DB connection
String query="insert into tbl_entrp_proj(ASPECT_SRC_ID,PRNT_PROJ_ID)values('" +
project.getASPECT_SRC_ID() + "','" +
project.getPRNT_PROJ_ID() + "')";
boolean b = dao.insertQuery(query);
请建议哪个是最好的,以及为什么。提前致谢。