需要处理内部有报价的名称

时间:2017-10-17 11:02:28

标签: sql oracle plsql qsqlquery

我有两个插入和更新数据库的查询 -

insertSQL = "insert into LineManager(LINEMANAGERID,LINEMANAGERNAME,BUSINESSGROUPID,STATUS) VALUES('" + lineManager.getLineManagerID() + "','" + lineManager.getLineManagerName() + "','" + lineManager.getBusinessGroupID() + "','" + lineManager.getStatus() + "')";

updateSQL = "update LineManager set BUSINESSGROUPID ='" + lineManager.getBusinessGroupID() + "' , LINEMANAGERNAME ='" + lineManager.getLineManagerName() + "' , STATUS ='" + lineManager.getStatus() + "' where LINEMANAGERID='" + lineManager.getLineManagerID() + "'";

到目前为止,它对于常规名称工作得很好,但是当LineManager名称类似于 - ' Doko N' dah,Dominick先生时,它正面临着问题。它在执行期间抛出异常。

有人可以帮忙解决这个问题吗?

1 个答案:

答案 0 :(得分:3)

使用bind variables

std::vector