% 'Dr. Thomas E. Hicks - Trinity University - File SearchUser2.asp
'Display all information in all records in which the UserName field
'[on SearchUsers1.html] matches partially the Name field of Table Users in
'database Security. %>
<% Option Explicit %>
SearchUser2.asp
<%
Dim Conn, UsersRecSet, Query
'Create a Connection Object
Set Conn = Server.CreateObject ("ADODB.Connection")
'Open Security ODBC with the Connection Object
Conn.Open "Security"
'Define the Query - declared as a variable because often long!
Query = "SELECT * FROM Users "
Query = Query & "WHERE Name Like " & "'%" & Request("UserName") & "%'"
'Create the Record Set Object
Set UsersRecSet = Server.CreateObject ("ADODB.Recordset")
'Fill the UsersRecSet with the Results of the SQL Query
Set UsersRecSet = Conn.Execute (Query)
%>
Display Users Whose Name Matches [Partial Match] - SearchUser2.asp
Dr. Thomas E. Hicks
Trinity University
<% Do Until UsersRecSet.EOF %>
Name : <% = UsersRecSet ("NAME") %>
No : <% = UsersRecSet ("NO") %>
Password : <% = UsersRecSet ("PASSWORD") %>
ID No : <% = UsersRecSet ("IDNO") %>
<% UsersRecSet.MoveNext
Loop
' Close the Connection. I try to close the connection asap.
Conn.Close %>