Linux中国  设为主页
 收藏本站
 
当前位置: > 首页 ->编程语言 ->ASP ->基于ASP的站内多值搜索
·学以致用 驳“ASP低能论” ·用VB构建Internet的应用·Asp的安全管理(12)·Windows 2000 安全性技术概述--3·Windows 2000 安全性技术概述--2·Windows 2000 安全性技术概述--1·ActiveX技术综述(二) ·ActiveX技术综述(一) ·动态网页技术--CGI:ASP:JSP:PHP(4)
  相关分类: 
ASP
ViualBasic
UML / Rational Rose
PHP4/PHP5
Perl
JAVA/JSP教程
Delphi
ColdFusion
CGI
C/C++
ASP.NET
XML
  站内搜索: 
热门文章排行
热门文章排行 ADO连接数据库字符串大全(04-23)
Asp教程:Response对象(04-23)
网站安全之ASP程序加密/解密方法大揭(04-23)
ASP函数库(05-31)
基于ASP的站内多值搜索(04-24)
精采文章排行
精采文章排行 从本质上看网页(asp,jsp)的编写(06-01)
学以致用 驳“ASP低能论” (06-01)
用VB构建Internet的应用(06-01)
Asp的安全管理(12)(06-01)
Windows 2000 安全性技术概述--3(06-01)
 

基于ASP的站内多值搜索

作者:Webmaster   来源:Linuxdby.com   点击:   日期:2007-04-24 [收藏] [投稿]

  IE是否经常中毒?推荐您

四川大学生物系
3
王 二
22222222
西南交通大学建筑系


Web搜索界面如下:

姓名:
电话:
学校:
搜索按钮


采用枚举法的源程序如下:
<%@ CODEPAGE = "936" %>
'连接数据库
<%
dim conn
  dim DBOath
dim rs
dim sql
  Set conn=Server.CreateObject("ADODB.Connection")
  DBPath = Server.MapPath("addressbook.mdb")
  conn.Open "driver={Microsoft Access Driver (*.mdb)};dbq=" & DBPath
Set rs=Server.CreateObject("ADODB.Recordset")
'从Web页获取姓名、电话、学校的值
dim Name
dim Tel
dim School
Name=request("Name")
Tel=request("Tel")
School=request("School")
'枚举法的搜索核心,因为有3个条件所以要写8组If判断语句
  if trim(Name)="" and trim(Tel)="" and trim(School)="" then
     sql="select * from address order by ID asc"
  end if
  if trim(Name)="" and trim(Tel)="" and trim(School)<>"" then
     sql="select * from address where School like '%"&trim(School)&"%' order by ID asc"
  end if
  if trim(Name)="" and trim(Tel)<>"" and trim(School)="" then
     sql="select * from address where Tel like '%"&trim(Tel)&"%' order by ID asc"
  end if
  if trim(Name)="" and trim(Tel)<>"" and trim(School)<>"" then
     sql="select * from address where Tel like '%"&trim(Tel)&"%' and School like '%"&trim(School)&"%' order by ID asc"
  end if
  if trim(Name)<>"" and trim(Tel)="" and trim(School)="" then
     sql="select * from address where Name like '%"&trim(Name)&"%' order by ID asc"
  end if
  if trim(Name)<>"" and trim(Tel)="" and trim(School)<>"" then
     sql="select * from address where Name like '%"&trim(Name)&"%' and School like '%"&trim(School)&"%' order by ID asc"
  end if
  if trim(Name)<>"" and trim(Tel)<>"" and trim(School)="" then
     sql="select * from address where Name like '%"&trim(Name)&"%' and Tel like '%"&trim(Tel)&"%' order by ID asc"
  end if
  if trim(Name)<>"" and trim(Tel)<>"" and trim(School)<>"" then
     sql="select * from address where Name like '%"&trim(Name)&"%' and Tel like '%"&trim(Tel)&"%' and School like '%"&trim(School)&"%' order by ID asc"

 如果您对本文有任何疑问或者建议,请到讨论区发表您的意见: >> 论坛入口 <<

上一页 1 2 3 4 56 7 8 下一页

上一篇:用PreRender解决DataGrid分页最后一页行数不满的排版问题   下一篇:XLS与MDB文件格式互换全攻略
文章评论】 【收藏本文】 【推荐好友】 【打印本文】 【我要投稿】 【论坛讨论

   相关文章:
·从本质上看网页(asp,jsp)的编写

   文章评论:(1条)
  
 请留名: 匿名评论   点击查看所有评论 论坛讨论
 

 声明:刊登此文章是为了传递更多信息,文章内容仅供参考,转载请注明出处。