查询有什么问题?

时间:2015-01-22 09:04:46

标签: asp.net sql-server vb.net visual-studio-2008

我在asp.net中使用VB实施此查询,该查询的目标是整理除@yahoo.com@gmail.com以外的电子邮件数据,它显示错误:

' @ yahoo'附近的语法不正确和' @ gmail"。

"select * from print_venue where not (email_id like %" & "@yahoo.com" & "%) AND (email_id like %" & "@gmail.com" & "%)"

上述查询有什么问题?

1 个答案:

答案 0 :(得分:4)

您忘记了like声明

周围的引号
"select * from print_venue 
where not (email_id like '%" & "@yahoo.com" & "%') 
AND (email_id like '%" & "@gmail.com" & "%')"

必须是

email_id like '%@yahoo.com%'

而不是

email_id like %@yahoo.com%