当前位置: 首页 > 图文教程 > 网络编程 > ASP > 用ASP和WML来实现数据库查询

ASP
asp #include命令
推荐下天枫常用ASP函数封装,推荐大家使用
asp最简单最实用的计数器
用asp实现的iframe批量替换工具
ASPWebPack 代码 提供下载
asp分页生成html的程序脚本代码
比较不错的asp单表单字段多条件查询
asp下用replace非正则实现代码运行功能的代码
UpdatePanel触发javascript脚本的方法附代码
生成EAN13标准的条形码的ASP代码实例
asp空间奸商查询系统
ASPWebPack(整站文件备份系统) v1.0.2 黑客也用
ASP+FSO可视化目录编历(可增、删、改)下载
提高ASP效率的五大技巧
ASP生成随机字符串(数字+大小写字母)的代码
ASP下存储过程编写入门全接触
利用 cache 做对比静态页的网页技术
ASP生成静态文件编码为UTF-8格式的HTML文件
ASP下的两个防止SQL注入式攻击的Function
asp下的风讯用的SQL通用防注入模块提供了

用ASP和WML来实现数据库查询


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-11-03   浏览: 158 ::
收藏到网摘: n/a

       贴一段ASP和WML查询数据库得代码,大家参考参考,其实跟ASP写WEB页面很相似得。
  
  <%Response.ContentType = "text/vnd.wap.wml"%>
  <?xml version="1.0"?><!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml">
  <wml>
  <%
   Dim conn, rs
   Dim strSQL,strFirstName, strLastName
   Set conn = Server.CreateObject("ADODB.Connection")
   Set rs = Server.CreateObject("ADODB.Recordset")
  
   conn.open session("myconnect_string") 'Replace with your connect string
  
   strWhoIs = Request.QueryString("username")
   if strWhoIs="" then
  %>
  <card id="UserSearch" title="Search">
  <p>
   Please enter username to find? <input name="username" type="text" maxlength="15"/>
  <do type="accept" label="Locate">
  <go href="thispage.asp" method="get">
  <postfield name="username" value="$username"/>
  </go>
  </do>
  </p>
  </card>
  <%
   else
    strSQL = "SELECT * FROM tblUsers WHERE Username ='& strWhoIs & '"
    Set rs = conn.Execute(strSQL)
  
  %> <card id="UserResult" title="Result">
  <p>
  <%
   if not rs.EOF then
    rs.MoveFirst
    Response.Write "<strong>User Search Results</strong>"
    While not rs.EOF
     strFirstName = "First Name " & rs("FirstName")
     strLastName = "Last Name " & rs("LastName")
     Response.Write strFirstName
     Response.Write strLastName
     rs.MoveNext
    Wend
   else
    Response.Write "Sorry, no user found."
   end if
  %>
  </p>
  </card>
  <%
  end if
  %>