I am trying to create a table search where when you type in a person's last name, the form will search the table and display the listings with the matching last name. However, I can't get it to display the results. Here is my ASP:
<body>
<% FindName = Request.Form("LastName" %>
<p align="center"><b>Database Search</b></p>
<form method="POST" name="search" action="database.asp">
<p align="center">
<b>Last name :</b>
<input type="text" name="Name" size="20"><input type="submit" value="Find" name="B1"></p>
</form>
<%
Set CNObj=Server.CreateObject("ADODB.Connection"
CNObj.Open "DBQ=e:\ajord461\4280\contacts.mdb;DRIVER=Microsoft Access Driver (*.mdb)"
Set RSObj=Server.CreateObject("ADODB.Recordset"
SQLString = "SELECT * FROM Personal WHERE LastName = '" & FindName & "'"
RSObj.Open SQLString,CNObj
Do While Not RSObj.EOF %>
<table>
<tr>
<td><%=RSObj.Fields("LastName"%></td>
<td><%=RSObj.Fields("FirstName"%></td>
<td><%=RSObj.Fields("MiddleName"%></td>
<td><a href="mailto:<%=RSObj.Fields("Email"%>">
<%=RSObj.Fields("Email"%></a></td></tr>
<% RSObj.MoveNext
Loop
RSObj.Close
CNobj.Close
%>
</table>
</body>
It is searching the table but not displaying the results. Anyone know what could be wrong? Thanks for the help!
<body>
<% FindName = Request.Form("LastName" %>
<p align="center"><b>Database Search</b></p>
<form method="POST" name="search" action="database.asp">
<p align="center">
<b>Last name :</b>
<input type="text" name="Name" size="20"><input type="submit" value="Find" name="B1"></p>
</form>
<%
Set CNObj=Server.CreateObject("ADODB.Connection"
CNObj.Open "DBQ=e:\ajord461\4280\contacts.mdb;DRIVER=Microsoft Access Driver (*.mdb)"
Set RSObj=Server.CreateObject("ADODB.Recordset"
SQLString = "SELECT * FROM Personal WHERE LastName = '" & FindName & "'"
RSObj.Open SQLString,CNObj
Do While Not RSObj.EOF %>
<table>
<tr>
<td><%=RSObj.Fields("LastName"%></td>
<td><%=RSObj.Fields("FirstName"%></td>
<td><%=RSObj.Fields("MiddleName"%></td>
<td><a href="mailto:<%=RSObj.Fields("Email"%>">
<%=RSObj.Fields("Email"%></a></td></tr>
<% RSObj.MoveNext
Loop
RSObj.Close
CNobj.Close
%>
</table>
</body>
It is searching the table but not displaying the results. Anyone know what could be wrong? Thanks for the help!