常用工具: 简繁转换 HTML/JS互转 Url编码Escape解析 Unicode编码转换 设为首页 加入收藏夹
更多内容
" id="arctext" class="center" " class="arcinfo center" " id="slistl" class="left" " id="mid_slistl_sch" class="left" " id="mid_slistl_adv" class="left" " id="mid_slistl_adv2" " src="http://www.fzs8.net/d/js/acmsd/middle2.js"
文章正文

ASP Hex 函数

来源:  网络收集  字体:[ ]
站内搜索系统
文章正文

ADO查询语句

来源:  网络收集  2007-04-28 00:00:00 字体:[ ]

We may use SQL to create queries to specify only a selected set of records and fields to view.
我们可以使用SQL来创建查询语句,让它仅对具有指定属性的记录和字段进行查找。


Examples
案例

Display records where "Companyname" starts with an A
显示“Companyname”中以“A”为首的记录:
How to display only the records from the "Customers" table that have a "Companyname" that starts with an A.
如何仅对"Customers"表中以“A”为首的“Companyname” 记录进行显示。

Display records where "Companyname" is > E
显示"Companyname" > E的记录
How to display only the records from the "Customers" table that have a "Companyname" that is larger than E.
如何仅对"Customers"表中以 “Companyname” 大于E的记录进行显示。

Display only Spanish customers
仅显示西班牙客户[Spanish customers]
How to display only the Spanish customers from the "Customers" table.
如何仅对"Customers"表中西班牙客户[Spanish customers]的记录进行显示。

Let the user choose filter
让用户进行自主选择
Let the user choose which country to show customers from.
让用户自行选择国家名,并显示出该国所对应的客户。


Display Selected Data
显示指定的数据

We want to display only the records from the "Customers" table that have a "Companyname" that starts with an A (remember to save the file with an .asp extension):
我们希望仅对"Customers"表中以“A”为首的“Companyname” 记录进行显示,具体代码如下(记住:使用“.asp”扩展名保存文件):

<html>
<body>
<%
set conn=Server.CreateObject("ADODB.Connection")
conn.Provider="Microsoft.Jet.OLEDB.4.0"

conn.Open "c:/webdata/northwind.mdb"
set rs=Server.CreateObject("ADODB.recordset")
sql="SELECT Companyname, Contactname FROM Customers
WHERE CompanyName LIKE 'A%'"
rs.Open sql, conn
%>
<table border="1" width="100%">

<tr>
<%for each x in rs.Fields
response.write("<th>" & x.name & "</th>")
next%>
</tr>
<%do until rs.EOF%>

<tr>
<%for each x in rs.Fields%>
<td><%Response.Write(x.value)%></td>
<%next
rs.MoveNext%>
</tr>

<%loop
rs.close
conn.close%>
</table>
</body>
</html>

Here is the result:
输出结果:

Companyname Contactname
Alfreds Futterkiste Maria Anders

  
上一篇:ADO显示记录
下一篇:ADO记录排序
最新文章
推荐文章
热门文章
版权所有:IT加油站   COPYRIGHT © 2007 WWW.FZS8.NET ALL RIGHTS RESERVED.
闽ICP备08008535号