这是我从c#
生成的查询Select * from contac
where ((LCASE(first_name) = '' and LCASE(sur_name) = 'bn d. o’connor & co' )
or
(LCASE(first_name) = 'bn d. o’connor & co' and LCASE(sur_name) = '' ))
and
Medicom_GP_KEY is null
但如果我执行并填充数据表意味着它显示错误,如
您的SQL语法有错误;查看与您的MariaDB服务器版本对应的手册,以获得在' connor&附近使用的正确语法。共' )或(LCASE(first_name)=' d。o' connor& co'和LCASE(sur _' at line 1
我不知道错误发生在哪里。
答案 0 :(得分:0)
您正在使用数据读取器上的撇号而不是初始SQL命令。您的命令应如下所示:
Select * from contac
where ((LCASE(first_name) = '' and LCASE(sur_name) = 'bn d. o''connor & co' )
or
(LCASE(first_name) = 'bn d. o''connor & co' and LCASE(sur_name) = '' ))
and
Medicom_GP_KEY is null
将单引号翻倍以逃避它们。