问题
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