Login | Register   
RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX

By submitting your information, you agree that devx.com may send you DevX offers via email, phone and text message, as well as email offers about other products and services that DevX believes may be of interest to you. DevX will process your information in accordance with the Quinstreet Privacy Policy.

Tip of the Day
Language: Web
Expertise: Beginner
Dec 1, 1999



Application Security Testing: An Integral Part of DevOps

Add Full-Text Search of an Access Database to ASP Pages

Although SQL Server 7 is the more robust and scalable database for full-text searching, many developers still use Microsoft Access for less-demanding database applications. You can search an Access database if you concatenate the field names in your query.

For example, in the following ASP code, the SQL query combines the FirstName and LastName fields, uses the keyword LIKE and then wraps the search fragment in wildcard characters. When run against the NorthWind database, this query produces a recordset of all employees with the letters "an" in their names.

<%@ Language=VBScript %>
<!--#include File="adovbs.inc"-->
Set conn = Server.CreateObject("ADODB.Connection")
Set rs = CreateObject("ADODB.Recordset")
conn.Open Application("Connection5_ConnectionString")
rs.CursorType = adOpenStatic
rs.LockType = adLockReadOnly
rs.CursorLocation = adUseClient
Set rs.ActiveConnection = conn
rs.Source = "SELECT * FROM Employees WHERE FirstName + Lastname LIKE '%an%'"
Do While Not rs.EOF
   Response.Write rs("FirstName") & " " & rs("LastName") & "<br>"
Set rs = Nothing
Set conn = Nothing
Ken Cox
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.
Thanks for your registration, follow us on our social networks to keep up-to-date