zoukankan      html  css  js  c++  java
  • asp: AJAX Database

    <% @LANGUAGE="VBSCRIPT" CODEPAGE="65001" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    
    <head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
    <title>AJAX Database</title>
    <script type="text/javascript">
    
    function showCustomer(str)
    {
    if (str=="")
      {
      document.getElementById("txtHint").innerHTML="";
      return;
      }
    if (window.XMLHttpRequest)
      {// code for IE7+, Firefox, Chrome, Opera, Safari
      xmlhttp=new XMLHttpRequest();
      }
    else
      {// code for IE6, IE5
      xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
      }
    xmlhttp.onreadystatechange=function()
      {
      if (xmlhttp.readyState==4 && xmlhttp.status==200)
        {
        document.getElementById("txtHint").innerHTML=xmlhttp.responseText;
        }
      }
    
    //str=document.getElementById("customers").value;
    //alert(str);
    xmlhttp.open("GET","getcustomer.asp?q="+str,true);
    xmlhttp.send();
    }
    </script>
    </head>
    
    <body>
    <form action=""> 
    <select name="customers" id="customers" onchange="showCustomer(this.value)">
    <option value="">Select a customer:</option>
    <option value="1">1</option>
    <option value="2">2</option>
    <option value="3">3</option>
    </select>
    </form>
    <br/>
    <div id="txtHint">Customer info will be listed here...</div>
    </body>
    
    </html>
    
    <% @LANGUAGE="VBSCRIPT" CODEPAGE="65001" %>
    
    <%
    response.expires=-1
    'q=ucase(request.querystring("q"))
    sql="SELECT * FROM users WHERE ID="
    sql=sql & "" & request.querystring("q") & ""
    'response.write q;
    
    
    set conn=Server.CreateObject("ADODB.Connection")
    conn.Provider="Microsoft.Jet.OLEDB.4.0"
    conn.Open(Server.Mappath("dbgeovindu.mdb"))
    set rs=Server.CreateObject("ADODB.recordset")
    rs.Open sql,conn
    
    response.write("<table>")
    do until rs.EOF
      for each x in rs.Fields
        response.write("<tr><td><b>" & x.name& "</b></td>")  '字段名
        response.write("<td>" & x.value& "</td></tr>") '值名
      next
      rs.MoveNext
    loop
    response.write("</table>")
    %>
    

     http://code.google.com/p/aspjson/downloads/list

    http://www.w3schools.com/asp/asp_ajax_database.asp

  • 相关阅读:
    pytest--重复执行用例 pytest-repeat
    python中查询mongo数据库
    pytest--将参数打到在报告中,ids参数
    pytest-html报告中,添加描述
    pytest-html报告
    pytest -fixture的3种用法(autouse=True)
    httprunner 创建run.py文件,执行套件或case,并生成测试报告
    pytest-使用自定义标记mark
    pytest 函数传参和fixture传参数request
    loadrunner-脚本设计
  • 原文地址:https://www.cnblogs.com/geovindu/p/3485010.html
Copyright © 2011-2022 走看看