问题描述
我在dotnetnuke的SQLGridSelectedView中遇到问题,如果我在姓氏"文本框中键入 O''Connell ,我将无法获得详细信息,但是如果键入 Connell 而不是我''将获得所有详细信息.
例如:
名字= Daniel
姓氏= O''Connell
SQL语句(仅适用于SELECT或EXEC): SELECT姓氏AS [姓氏],名字AS [姓氏],办公室AS位置,部门,电话,"''作为来自crestron_directory的电子邮件,(姓氏不是空且姓氏<>'''')AND(姓氏不是空且姓氏<>'''')AND((((WindowsEmailAddress< ;>``[email protected]'')AND(WindowsEmailAddress<> [email protected]'')AND(WindowsEmailAddress<>``'')AND(WindowsEmailAddress不为null)) )
文本搜索
搜索子句:(姓氏类似''%[Search2:Text]%'')
我已经尝试过
-(LastName LIKE''%''''[[Search2:Text]%'')
-(LastName LIKE''%''''''[Search2:Text]%'')
-(LastName LIKE''%\''[Search2:Text]%'')
-(LastName LIKE''%''''[[Search2:Text]%'')
-(LastName LIKE''%"+ [Search2:Text] +"%'')
-(LastName LIKE''%"+ [Search2:Text] +"%"
")
谢谢
Hi,
I am facing a probleam in SQLGridSelectedView from dotnetnuke, If I type O''Connell in my LastName Textbox I coudn''t get the detail but if I type Connell than I''ll get all the details.
For Example :
First Name = Daniel
Last Name = O''Connell
SQL Statement(SELECT or EXEC Only): SELECT LastName AS [Last Name], FirstName AS [First Name],Office AS Location, Department, Phone, '''' AS Email FROM crestron_directory WHERE (LastName IS NOT NULL AND LastName <> '''') AND (FirstName IS NOT NULL AND FirstName <> '''') AND (((WindowsEmailAddress <> ''[email protected]'') AND (WindowsEmailAddress <> ''[email protected]'') AND (WindowsEmailAddress <> '''') AND (WindowsEmailAddress is not null)))
Text Search
Search Clause: (LastName LIKE ''%[Search2:Text]%'')
I have tried
-(LastName LIKE ''% ''''[Search2:Text]%'')
-(LastName LIKE ''% ''''''[Search2:Text]%'')
-(LastName LIKE ''% \''[Search2:Text]%'')
-(LastName LIKE ''% ''''[Search2:Text]%'')
-(LastName LIKE ''%" + [Search2:Text] + "%'')
-(LastName LIKE ''%" + [Search2:Text] + "%''
")
Thank you
推荐答案
replace(FIELD, "'", "''")
这篇关于带撇号的sql查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!