日期:2014-05-17 浏览次数:20961 次
public int insertValue(int pid,String vcode,String vvalue,String state,String mname){ int flag = 0; Session session = null; Transaction tr = null; try{ if(pid>0&&vcode!=null&&vvalue!=null&&mname!=null){ session = getSession(); String sql = "insert into sf_3_clinic(pid,"+vcode+") values("+pid+","+vvalue+")"; System.out.println(sql); tr=session.beginTransaction(); //Statement state1 = session.connection().createStatement(); session.createSQLQuery(sql); tr.commit(); session.close(); } }catch(Exception e){ e.printStackTrace();return 0; } return 0; }