Forums
This topic is locked
show if recordset is empty - beginner's issue
27 Mar 2007 18:46:00 tony kwan posted:
Hello everyone,I just started playing around with DW again at my workplace. And I'm having some issues with the "show region if recordset is empty" server behavior. Basically, I'm making a search form, and I want a hidden message to pop up when the user types in a incorrect match. But when you load the page, it automatically displays the message...how can I resolve this...thanks for any assistances. tony
<%@LANGUAGE="VBSCRIPT"%>
<!--#include file="Connections/team.asp" -->
<%
Dim team__MMColParam
team__MMColParam = "1"
If (Request.Form("last_name" <> "" Then
team__MMColParam = Request.Form("last_name"
End If
%>
<%
Dim team
Dim team_numRows
Set team = Server.CreateObject("ADODB.Recordset"
team.ActiveConnection = MM_team_STRING
team.Source = "SELECT * FROM team WHERE last_name LIKE '%" + Replace(team__MMColParam, "'", "''" + "%' ORDER BY last_name ASC"
team.CursorType = 0
team.CursorLocation = 2
team.LockType = 1
team.Open()
team_numRows = 0
%>
<% If team.EOF And team.BOF Then %>
<table width="500" border="1">
<tr>
<td>No Matches Found. Please Try Again...</td>
</tr>
</table>
<% End If ' end team.EOF And team.BOF %>
<%
team.Close()
Set team = Nothing
%>