如何使字符串带有'号?
比如
有一段SQL语句:select * from sysobjects where type = 'U'
j将该语句赋值给String类的str如何写语句?
比如
有一段SQL语句:select * from sysobjects where type = 'U'
j将该语句赋值给String类的str如何写语句?
解决方案 »
- 我想知道怎么用DELPHI,调用WMI的方法来改变系统的配置,比如IP地址啊!
- 新手求助:TStringList不是默认安装的组件,怎么装呀?
- 表有3个属性:价格,数量,总额。在DBGridEh显示出来,但只要求给用户修改价格和数量,系统就可以得到总额并更新。请问改怎么实现?
- ★☆★☆★保证让您的编程周期至少缩短三分之一!
- 各位,看看如何将网页和程序联系起来?
- 如何读取outlook的地址簿
- 如何在数据库中动态建立一个新表
- 是否还有必要?
- 怎么让整个窗体一打开就充满这个屏幕呢?
- 请高手指教!!
- 如何在自定义控件中使用程序的句柄
- fastreport奇怪的问题,在文本编辑器中输入的汉字显示乱码,如何解决?
strSql := 'select * from sysobjects where '+
' type = '+
''''+'u'+'''';
或
strSql:='select * from sysobjects where type = "U"'
strings := 's'''; // strings的值:s'
strings := 's''s'; // strings的值:s's
QuotedStr加'的函数.
用#39 代表单引号
strSql := 'select * from sysobjects where type = '+ #39+#39+'u'+#39+#39;
delphi中的字符串中的单引号'是用2个'来代表的,
因此
'select * from sysobjects where '+' type = '+''''+'u'+'''';
=(把'+'去掉) 'select * from sysobjects where type= ''u''' ;
此外,某些数据库的字符串是用双引号引起来的,因此,还可以写作
(用"代替'') 'select * from sysobjects where type= “u”' ;