2

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!

Max
  • 12,622
  • 16
  • 73
  • 101
  • http://stackoverflow.com/questions/603572/how-to-properly-escape-a-single-quote-for-a-sqlite-database?rq=1 – Sandy Mar 04 '13 at 11:34

3 Answers3

7

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)
letiagoalves
  • 11,224
  • 4
  • 40
  • 66
4

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

Anonymous
  • 575
  • 1
  • 4
  • 11
-1
INSERT INTO Department (Code, Name, CountryID) VALUES ('ZE', 'Zeeland ''96', 1)
Akshay Joy
  • 1,765
  • 1
  • 14
  • 23