Print Page | Close Window

Search Script

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: Classic ASP Discussion
Forum Description: Discussion on Active Server Pages (Classic ASP).
URL: https://forums.webwiz.net/forum_posts.asp?TID=4708
Printed Date: 30 March 2026 at 11:29am
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: Search Script
Posted By: Bliss
Subject: Search Script
Date Posted: 03 August 2003 at 12:30pm
Can anyone show me a simple search script to search a field in an access database?



Replies:
Posted By: MadDog
Date Posted: 03 August 2003 at 2:06pm
Just replace rsCommon with your database connection, strInputSearch with the search word or request.form variable, tblTableName with your actual table name, and Field_name with your actually field_name you are searching.

Code:

<%
strInputSearch = "Your search word or form variable"

strSQL = "SELECT tblTableName.* FROM tblTableName "
strSQL = strSQL & "WHERE tblTableName.Field_name LIKE '%" & strInputSearch & "%';"

rsCommon.Open strSQL, adoCon

If rsCommon.EOF Then
      Response.Write("No Records Found")
Else
      DO UNTIL rsCommon.EOF
             Response.Write(rsCommon("Field_name") & "<br>")
      rsCommon.MoveNext
      Loop
End if

rsCommon.Close
%>

-------------
http://www.iportalx.net" rel="nofollow">


Posted By: Bliss
Date Posted: 03 August 2003 at 2:28pm
Thanx.



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net