PrepareStatement中in中带问号的用法(轉)

String strSQL = " DELETE FROM TAB_DESIREMOTOR WHERE DESIREMOTORID IN ( ? ) " ;
ps  =  conn.prepareStatement(strSQL);
java.util.Vector v = new  Vector();
v.addElement( new  Int( 1 ));
v.addElement( new  Int( 2 ));
ps.setObject( 1 , v);
count  =  ps.executeUpdate();


若需要將字串轉為Vector,這樣就不用一個一個加入到Vector了
String ss="aa,bb,cc,dd";
  List l = Arrays.asList(ss.split(","));
  Vector v = new Vector(l);

你可能感兴趣的:(java)