日期:2014-05-16 浏览次数:20407 次
if(null != data && 0 != data[0]){
lists(data);
}
function lists(data, index) {
var i = index
------解决方案--------------------
0;
var l = data.length;
var staffNo, sql;
if(i < l) {
staffNo = data[i]
sql = "select COUNT(a.objectAnswer) answerCount from MassPaperResultRecord a ";
sql += " where 1 = 1 and a.status = 1 and a.massCode = 33 ";
sql += " and a.objectClass = 'S' and a.objectDept = '101' and a.objectStaffNo = " + staffNo;
db.doQuery(sql,function(r){
lists(data, i + 1);
});
}
}
var sql = '第一句sql语句';
var max = 10, now = 0;
db.doQuery(sql, callback);
function callback(r) {
now++;
//根据拼装下一个sql语句
if (now < max) db.doQuery(sql, callback);///////未达最大下标继续查询
}