例子如下:(其中“zhxxdb”是一个foxpro数据源,指向被访问库所在的路径)
<% dim i,star,lend,tsql
sql=request.querystring("q")
if sql="" then
sql=Session("query")
end if
Session("query")=sql
for i=1 to len(sql)-4
if mid(sql,i,4)="like" then
star=i+5
lend=i+6
while mid(sql,lend,1)<>"'"
lend=lend+1
wend
sql=left(sql,star-1)+"%"+mid(sql,star,lend-star)+"%"+mid
(sql,lend,len(sql)-lend+1)
end if
next
set objdbconnection=server.createobject("ADODB.Connection")
objdbconnection.open "zbxxdb"
set zbxx=objdbconnection.execute(sql)
if zbxx.bof and zbxx.eof then
response.write "很抱歉,没有找到您所需要的数据!!

<% dim i,star,lend,tsql
sql=request.querystring("q")
if sql="" then
sql=Session("query")
end if
Session("query")=sql
for i=1 to len(sql)-4
if mid(sql,i,4)="like" then
star=i+5
lend=i+6
while mid(sql,lend,1)<>"'"
lend=lend+1
wend
sql=left(sql,star-1)+"%"+mid(sql,star,lend-star)+"%"+mid
(sql,lend,len(sql)-lend+1)
end if
next
set objdbconnection=server.createobject("ADODB.Connection")
objdbconnection.open "zbxxdb"
set zbxx=objdbconnection.execute(sql)
if zbxx.bof and zbxx.eof then
response.write "很抱歉,没有找到您所需要的数据!!
"
response.write" 单击这里返回上一页!
"
response.write " 抱 歉!!!'>
"
else
zbxx.movefirst
irst