问题描述
我正在尝试使用Node.js和MSsql模块向sql Server发送查询
const dataSend = new Promise((resolve,reject) => {
sql.connect(config).then(pool => {
myQuery = "INSERT INTO persoane ([name],telefon) VALUES ('"+req.body.name+"','"+req.body.telefon+"')";
resolve(pool.request().query(myQuery));
reject('Error in dataSend');
})
});
使用sql Server Profiler,我可以看到查询发送到sql Server的方式为:
'INSERT INTO persoane ([name],telefon) VALUES (' 'John' ',' '11111111111' ')'
VALUES
上的双引号引起错误。如何在最终查询中只写一个单引号?
我串联错了还是MSsql提供的信息?
谢谢!
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)