在SQLite中插入单引号 [英] Insert Single quotes in SQLite

查看:91
本文介绍了在SQLite中插入单引号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将以下文本添加到我的数据库中:Zeeland '96

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

但是单引号给了我错误.

But the single quote is giving me errors.

它应该看起来像这样:

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?

提前谢谢!

推荐答案

您可以看到此处您需要通过在一行中使用两个单引号来对其进行转义.试试:

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)

这篇关于在SQLite中插入单引号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆