有关查询的问题?请教!!!

suntoday 2003-08-21 05:25:55
怎么能实现这样的查询,一个表单,里面有型号栏和技术资料栏,当你输入型号为EM78P447时,
查询后和447有关的关键字都会显示出来,这样的应该怎么写呀,我见过用PHP写的,不知ASP可以吗?如果可以程序是怎么工作的,谢谢!
...全文
56 12 打赏 收藏 转发到动态 举报
写回复
用AI写文章
12 条回复
切换为时间正序
请发表友善的回复…
发表回复
vivisogood 2003-08-22
  • 打赏
  • 举报
回复
如果你要后面三位数字或几位也可以这样

<%
bb=trim(request("xinghao"))
aa=len(bb)
aa=aa-2
response.write(mid(bb,aa,3))
%>
Ianlan 2003-08-22
  • 打赏
  • 举报
回复
不好意思,sql语句错了,应该是

Sql="select * from table where xh like '%"& xh1 &"'"
Ianlan 2003-08-22
  • 打赏
  • 举报
回复
你需要的是把输入的型号最后的数字部分给提取出来,可以这样做
<%
xh=request.form("xh")
if xh="" then
response.write "alert!!!"
response.end
end if
xh1=""
for i=len(xh) to 1 step -1
if not isnumeric(mid(xh,i,1)) then
exit for
end if
xh1=mid(xh,i,1)+xh1
next
if xh1="" then
response.end
end if
Set rs=Server.CreateObject("ADODB.RECORDSET")
Sql="select xh from table where title like '%"& xh1 &"'"
rs.Open Sql,conn,1,1
do not rs.eof
response.write rs("xh")
rs.movenext
loop
%>
vivisogood 2003-08-22
  • 打赏
  • 举报
回复
for i=1 to len(aa)
a=mid(aa,i,1)
if (asc(a)<asc(0) or asc(a)>asc(9) ) then
取出第几位开始是数字
end if
next

aa 是传过来的型号。 你判断出来第几位开始是数字!
可以用用mid 或者 left() 取出数字就是编号了
再用 select * from table where name like '%"&传过来的编号&%'




guchenghong 2003-08-22
  • 打赏
  • 举报
回复
Sql="select * from 表名 where 型号 like '%"& 查询内容&"%' "
geniusxch 2003-08-22
  • 打赏
  • 举报
回复
<%
your=request.form("tbname")
Set rs=Server.CreateObject("ADODB.RECORDSET")
Sql="select * from database where title like '%"& your &"%' "
rs.Open Sql,Mycon,1,1

do not rs.eof %>
<%=rs("字段名") %>

<%
rs.movenext
loop
%>
pp4u 2003-08-22
  • 打赏
  • 举报
回复
Sql="select * from database where 型号 like '%"& 333 &"%' "
suntoday 2003-08-22
  • 打赏
  • 举报
回复
我的447只是一个比方,如果是LM358那和358一样的型号都会出来,不管是多长的型号只要有358的都会出来。我想要这样的程序,也就是说不管型号是什么,里面只要有和查询的数字相同的都会出来,这样的应该怎么写。谢谢
xiejunhua 2003-08-21
  • 打赏
  • 举报
回复
name从上一个form提交页面获得。

1页
<input type="text" name="tbname" value="447">

2页
<%
your=request.form("tbname")
Set rs=Server.CreateObject("ADODB.RECORDSET")
Sql="select * from database where title like '%"& your &"%' "
rs.Open Sql,Mycon,1,1

do not rs.eof %>
<%=rs("字段名") %>

<%
rs.movenext
loop
%>
所有关于有447 的信息全都显示出来了。
zhaobohao 2003-08-21
  • 打赏
  • 举报
回复
sql="select * from table where type like '%"&left("em78p447",3)&"%'"
freetaiger 2003-08-21
  • 打赏
  • 举报
回复
不对
是 left(type,3)='447'
freetaiger 2003-08-21
  • 打赏
  • 举报
回复
在sql 语句中的条件指定
sql = " select * from table where left(type)='447'"

28,390

社区成员

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

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