日期:2014-05-17 浏览次数:20569 次
String sq1="select * from HrEmployee where cardid in("+sa+")"; String sq2="select * from EquFinger where cardid in("+sa+")"; String sq3="select * from EquCard where cardid in("+sa+")"; String st1[][]=msql.executeQuery(sq1,strDB1); String st2[][]=msql.executeQuery(sq2,strDB1); String st3[][]=msql.executeQuery(sq3,strDB1); String sqla0="insert into HrEmployee(EmplID,WorkID,CardID,DeptID,EmplName,Sex,EntryDate,LeaveYN,LastOperId,LastOperDate ) values (?,?,?,?,?,?,?,?,?,?)"; String sqla1="insert into EquFinger (EmplID,CardNo,BackupID,Privilege,pws ) values (?,?,?,?,?)"; String sqla2="insert into EquCard (CardNo,EmplID,CardType,CardStatus ) values (?,?,?,?)"; PreparedStatement psStatementin=msql.executeUpdate(sqla0,strDB2); for(int i=0;i<st1.length;i++) { psStatementin.setString(1,st1[i][0]); psStatementin.setString(2,st1[i][1]); psStatementin.setString(3,st1[i][2]); psStatementin.setString(4,st1[i][3]); psStatementin.setString(5,st1[i][4]); psStatementin.setString(6,st1[i][5]); psStatementin.setString(7,st1[i][6]); psStatementin.setString(8,st1[i][7]); psStatementin.setString(9,st1[i][8]); psStatementin.setString(10,st1[i][9]); psStatementin.addBatch(); } psStatementin.executeBatch(); msql.close(); PreparedStatement psStatementin1=msql.executeUpdate(sqla1,strDB2); for(int i=0;i<st2.length;i++) { psStatementin1.setString(1,st2[i][0]); psStatementin1.setString(2,st2[i][1]); psStatementin1.setString(3,st2[i][2]); psStatementin1.setString(4,st2[i][3]); psStatementin1.setString(5,st2[i][4]); psStatementin1.addBatch(); } psStatementin1.executeBatch(); msql.close(); PreparedStatement psStatementin2=msql.executeUpdate(sqla2,strDB2); for(int i=0;i<st3.length;i++) { psStatementin2.setString(1,st3[i][0]); psStatementin2.setString(2,st3[i][1]); psStatementin2.setString(3,st3[i][2]); psStatementin2.setString(4,st3[i][3]); psStatementin2.addBatch(); } psStatementin2.executeBatch(); msql.close();