Latest web development tutorials

ADO Query

We can use SQL to create queries, so you can specify only view the selected records and fields.


Display selected data

We want to only show "Companyname" field "Customers" table starts with A records:

Examples

<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>

Examples show »


Examples

More examples

Display "Companyname" greater than E records
How to display only "Companyname" field "Customers" table is greater than E records.

Display only customers in Spain
How to display only "Customers" table of Spanish customers.

Allowing users to choose the screening criteria
Allowing users to select customers based on country