我想插入我从中得到的值req.body
。我将它保存在变量中,然后将它们作为插入查询中的值传递。但表中没有保存任何内容。请帮帮我:
var name=req.body.Name;
var CreatedBy=req.body.CreatedBy;
var CreatedDate=req.body.CreatedDate;
var ModifiedBy=req.body.ModifiedBy;
var ModifiedDate=req.body.ModifiedDate;
var email=req.body.Email;
var idAgency= Guid();
console.log(name);
client.query('INSERT INTO Agency (idAgency ,Name,CreatedBy, CreatedDate, ModifiedBy , ModifiedDate ,Email, Active ) VALUES (idAgency ,name ,CreatedBy ,CreatedDate, ModifiedBy ,ModifiedDate,email, 1)', function(err,data){
if(err){
console.log(err);
console.log(" not inserted") ;
}
else{
console.log("insert");
console.log(data) ;
}
});