求SQL中文模糊查询语句

shadelin 2005-04-04 03:42:32

<%
where_clause="where"
if name <> "" then
where_clause=where_clause & " name like " & name
end if

sqlstr="select * from customer " & where_clause & " order by id"
set data_article=common_connection.execute(sqlstr)
%>

name的值是中文时
上述代码报错:
Microsoft OLE DB Provider for ODBC Drivers 错误 '80040e14'
[Microsoft][ODBC Microsoft Access Driver] WHERE 子句语法错误。

SQL模糊查询不支持中文?还是格式有错误。
谢谢!
...全文
175 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
hbhbhbhbhb1021 2005-04-04
  • 打赏
  • 举报
回复
你的那上面where前面少了一个空格
fcuandy 2005-04-04
  • 打赏
  • 举报
回复
<%
where_clause=""
if name <> "" then
where_clause=where_clause & " and [name] like '%" & name & "%'"
end if

sqlstr="select * from [customer] where 1=1 " & where_clause & " order by id"
set data_article=common_connection.execute(sqlstr)
%>
lstup 2005-04-04
  • 打赏
  • 举报
回复
select * from [table] whre name like '%"&name&"%'
xuStanly 2005-04-04
  • 打赏
  • 举报
回复
where_clause=where_clause & " name like '%" & name & "%'"
lstup 2005-04-04
  • 打赏
  • 举报
回复
你这叫模糊查询?

28,406

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧