当前位置: 首页 > 网络学院 > 服务端脚本教程 > ADO > ADO查询语句
We may use SQL to create queries to specify only a selected set of records and fields to view.
我们可以使用SQL来创建查询语句,让它仅对具有指定属性的记录和字段进行查找。
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.
让用户自行选择国家名,并显示出该国所对应的客户。
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> <% set rs=Server.CreateObject("ADODB.recordset") <table border="1" width="100%"> </body> |
Here is the result:
输出结果:
Companyname | Contactname |
---|---|
Alfreds Futterkiste | Maria Anders |