Asp > ADO
How to filter a recordset
How to filter a recordset
Place Document Title Here
<% Set cn = Server.CreateObject("ADODB.Connection") Set rs = Server.CreateObject("ADODB.RecordSet") cn.Open Application("guestDSN") rs.ActiveConnection = cn rs.CursorType = adOpenStatic rs.LockType = adLockOptimistic rs.Source = "SELECT * FROM authors" rs.Open %>
>
Before Filter
<% For i = 0 To RS.Fields.Count - 1 %>
<%= RS(i).Name %>
<% Next %>
<% Do While Not RS.EOF %>
<% For i = 0 To RS.Fields.Count - 1 %>
<%= RS(i) %>
<% Next %>
<% RS.MoveNext Loop rs.Filter = "phone LIKE '415%'" rs.MoveFirst %>
>
After Filter
<% For i = 0 To RS.Fields.Count - 1 %>
<%= RS(i).Name %>
<% Next %>
<% Do While Not RS.EOF %>
<% For i = 0 To RS.Fields.Count - 1%>
<%= RS(i) %>
<% Next %>
<% RS.MoveNext Loop rs.MoveFirst RS.Close Cn.Close %>
Asp Codes
ActiveX
ADO
Array
Code Snippets
Components
Data Access
Date Time
Files
Graphics
HTML Formatting
Mathematics
Miscellaneous
Sessions
SQL
Strings
Techniques
XML