我用的是ACCESS,下面是我现在搜索用的代码:
keyword=request.Form("keyword")
keyword=Ltrim(Rtrim(keyword))
if instr(keyword," ")<>0 then
str = split(keyword," ")
for i=0 to ubound(str)
if i=0 then
sqlstr = sqlstr&" [a] like '%"&str(i)&"%'"
else
sqlstr = sqlstr&" or [a] like '%"&str(i)&"%'"
end if
next
sqlstr="select * from pros where "&sqlstr
sqlstr =sqlstr & " order by id "
else
sqlstr="select * from pros "
sqlstr = sqlstr & " where [a] like '%" & keyword & "%' "
sqlstr =sqlstr & " order by id "
end if作者: 冰美人 时间: 2009-12-27 06:47
数据库自己的排序做不到这样
你只能三次查询数据库,然后安装你要求的顺序输出作者: dgyys 时间: 2010-3-25 15:05
楼主强呀,这样贴子也能发表出来,对你佩服之心比长江的水还多哦