可以执行多条sql语句啊 mSql="select * from t_flow_f where id='"+mId+"'"; result=DbaObj.ExecuteQuery(mSql); result.next(); myFlowNo=result.getInt("flowno"); mFlowSort=result.getString("flowsort");
mSql="select * from t_flow_f where file_source_id= '"+file_source_id+"' and flowsort= '"+mFlowSort+"' order by flowno desc"; result=DbaObj.ExecuteQuery(mSql); result.next(); flowNo=result.getInt("flowno"); if(flowNo!=myFlowNo) { myFlowNo=myFlowNo+1;
mSql="update t_flow_f set enable='1' where ad_type='核稿' and flowsort= '"+mFlowSort+"' and file_source_id='"+file_source_id+"' and flowno='"+myFlowNo+"'"; prestmt=DbaObj.Conn.prepareStatement(mSql); DbaObj.Conn.setAutoCommit(true) ; prestmt.executeUpdate(); DbaObj.Conn.commit();
只要 String sql = "select * from yourtable"; String sql1 = "update yourtable1 set ......"; stmt.executeQuery(sql); or stmt.executeUpdate(sql1); ... ...
mSql="select * from t_flow_f where id='"+mId+"'";
result=DbaObj.ExecuteQuery(mSql);
result.next();
myFlowNo=result.getInt("flowno");
mFlowSort=result.getString("flowsort");
mSql="select * from t_flow_f where file_source_id= '"+file_source_id+"' and flowsort= '"+mFlowSort+"' order by flowno desc";
result=DbaObj.ExecuteQuery(mSql);
result.next();
flowNo=result.getInt("flowno");
if(flowNo!=myFlowNo)
{
myFlowNo=myFlowNo+1;
mSql="update t_flow_f set enable='1' where ad_type='核稿' and flowsort= '"+mFlowSort+"' and file_source_id='"+file_source_id+"' and flowno='"+myFlowNo+"'";
prestmt=DbaObj.Conn.prepareStatement(mSql);
DbaObj.Conn.setAutoCommit(true) ;
prestmt.executeUpdate();
DbaObj.Conn.commit();
String sql = "select * from yourtable";
String sql1 = "update yourtable1 set ......";
stmt.executeQuery(sql);
or
stmt.executeUpdate(sql1);
...
...
谢谢leshui(大象无形)(有物混成,先天地生) 的代码