Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

RecordCount Issue

Status
Not open for further replies.

mych

Programmer
May 20, 2004
248
GB
Hi,

I have the following code:

Code:
<%
'############## BMA Incident Search Routine ################

strSQL = "SELECT * FROM B_INCIDENTS WHERE BIncidentRef LIKE'%" & search & "%' OR BEARS LIKE '%" & search & "%' OR BIncident LIKE'%" & search & "%' OR BUpdates LIKE '%" & search & "%' or BResolution LIKE '%" & search & "%' OR BServer LIKE '%" & search & "%' OR BCPU LIKE '%" & search & "%' OR BService LIKE '%" & search & "%';"

'response.write(strSQL)

Set rsSearch = Server.CreateObject("ADODB.Recordset")
rsSearch.Open strSQL, my_Conn

RecCount = rsSearch.RecordCount

If RecCount = 0 Then %>
    <center>
    <b>BMA Section - Search results for : "<%=search%>" <font color=red size=3>No BMA Incidents found!</font></center>"
    <br />
<%
Else
%>
    <center><b>BMA Incident Section - Search results for : "<%=search%>" found <%=reccount%><% If reccount = 1 then %> Incident<% else %> Incidents<% end if %></b></center>
    <br />
    <center><a href="BIncidentSearch.asp?search=<%=search%>&num=<%=show%>">Click Here to View Results</a></center>
    <br />
<%
End If

rsSearch.Close
Set rsSearch = Nothing
%>

When I run the strSQL directly against the database for a search word of say "ISSUE" I get 2 records.

The asp page give a result of

BMA Incident Section - Search results for : "ISSUE" found -1 Incidents

If I run the strSQL directly against the database for a search word of say "HELP" I get 0 records.

The asp page in this case still give a result of

BMA Incident Section - Search results for : "HELP" found -1 Incidents

Where have I gone wrong?

Mych
 
The problem has been posted here before. You might try reviewing this thread to see if it sheds any light on the issue: thread333-1347672

------------------------------------------------------------------------------------------------------------------------
"Men occasionally stumble over the truth, but most of them pick themselves up and hurry off as if nothing ever happened."
- Winston Churchill
 
Thanks for this... Issue fixed
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top