Insert Single quotes in SQLite

我是研究僧i 提交于 2020-07-09 05:50:08

问题


I'm trying to add the following text to my database: Zeeland '96

But the single quote is giving me errors.

It should look like this:

INSERT INTO Department (Code, Name, CountryID) VALUES ('ZE', 'Zeeland '96', 1)

As you can see, at this moment is one quote missing, how can I get rid of this problem?

Thanks in advance!


回答1:


As you can see HERE you need to escape it by using two single quotes in a row. Try:

INSERT INTO Department (Code, Name, CountryID) VALUES ('ZE', 'Zeeland ''96', 1)



回答2:


Assuming you're using .NET Library, you can use the SQLiteParameter types to build an SQL command string.




回答3:


INSERT INTO Department (Code, Name, CountryID) VALUES ('ZE', 'Zeeland ''96', 1)


来源:https://stackoverflow.com/questions/15200461/insert-single-quotes-in-sqlite

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!