1. If the Description field in param is left empty, an error will be reported as shown in the figure
.
function insertData (data) {
var values=[];
async.map(data,function(item,cb){
_getNewSN({
query:{category : "ProjectOID_" + item.ProjectOID},
success:function(sn){
var param=[parseInt(item.FunctionCode) ,
parseInt(item.StartRegister) ,
parseInt(item.Length) ,
item.Description ,
item.ProjectHardwareOID ,
sn.SN];
cb(null,param)
},
error : sender.error
});
},function(err,values){
// console.log(values);
var sql = "insert into " +
"plcModbusTCPDB(FunctionCode,StartRegister," +
"Length,Description,ProjectHardwareOID," +
"DataID) values ";
var param="";
var parameters=[];
for(var i=0;i<values.length;iPP){
var element = values[i].toString();
console.log(element);//:"3,1,1,,418,336","3,2,1,,418,337",Description
param += "(" + element + ")";
parameters.push(element);
}
sql+=param;
// console.log(sql);
yjDBService.exec({
sql : sql,
// parameters : parameters,
success : sender.success,
error : sender.error
});
})
}
problem description
the environmental background of the problems and what methods you have tried
related codes
/ / Please paste the code text below (do not replace the code with pictures)