Friday, December 14, 2007

How to select the only information that we want to show to the user?

How to select the only information that we want to show to the user?

Now, we try to s How a list of the member whose location is "LA":


The ASP codes are written and described as below:


<%

Set conn = Server.CreateObject("Adodb.Connection")

conn.Open "Driver={Microsoft Access Driver (*.mdb)};DBQ=" & Server.MapPath("db1.mdb")

Set rs = Server.CreateObject("Adodb.Recordset")

rs.Open "Member",conn,1,3

rs.Filter = "Location = 'LA'" 'We set a filter that the recordset will only s How the member location is "LA"

If rs.EOF Then 'If Eof is True; that means it is not record

%>

<%

Else

Do while Not rs.eof

%>

<%

rs.movenext

Loop

End If

rs.Close

Set rs = Nothing

%>

No member...
<%=rs("MemID")%> <%=rs("MemberName")%> <%=rs("Location")%>


No comments: