<%
Dim oConn,oRs
Set oConn=Server.CreateObject("ADODB.Connection")
oConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Server.MapPath("db1.mdb")
Set ors = Server.CreateObject("ADODB.RecordSet")
ors.Open "select * from t1 where age>20",oConn,1,2
Response.Write "一次检索:select * from t1 where age>20<br/>"
Response.Write "----------------------------------<br/><br/>"
Do while not ors.Eof
Response.Write ors("name") & ":" & ors("age") & "<br/>"
ors.MoveNext
Loop
Response.Write "总计:" & ors.RecordCount & "<br/>"
Response.Write "----------------------------------<br/><br/>"
Response.Write "二次检索:Filter(name like '王%')<br/>"
Response.Write "----------------------------------<br/><br/>"
ors.Filter = "name like '王%'"
If not(oRs.Eof and ors.Bof) Then ors.MoveFirst
Do while not ors.Eof
Response.Write ors("name") & ":" & ors("age") & "<br/>"
ors.MoveNext
Loop
Response.Write "总计:" & ors.RecordCount & "<br/>"
Response.Write "----------------------------------<br/>"
ors.Close
Set ors = Nothing
oConn.Close
Set oConn = Nothing
%>