- public int addORDelAgentPerson(String strTableID,String strUserID,String strAgentID,String strType)throws Exception{
- Connection conn= null;
- CallableStatement cbst = null;
- ResultSet rs = null;
- String procedure = "{call SP_SetDevolvePerson(?,?,?,?)} ";
- //int count = 0;
- try{
- conn = jbpu.getConnection();
- conn.setAutoCommit(false);
- cbst = conn.prepareCall(procedure);
- cbst.setString(1, strTableID);
- cbst.setString(2, strUserID);
- cbst.setString(3, strAgentID);
- cbst.setString(4, strType);
- //count = cbst.executeUpdate();
- cbst.executeUpdate();
- conn.commit();
- return 1;
- }catch(Exception e){
- conn.rollback();
- e.printStackTrace();
- return 0;
- }finally{
- jbpu.close(rs, cbst, conn);
- }
- }
注:
1、JDBC通过CallableStatement 接口调用存储过程;
2、jbpu是封装好的一个jdbc工具类实例;
3、jdbc传参的起始序号为1;
4、return 0或1,只是标识是否执行成功,也可用其它方式标识。
本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请
点击举报。