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

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 %><%Set conn = Server.CreateObject("ADODB.Connection")Set rs = CreateObject("ADODB.Recordset")conn.Open Application("Connection5_ConnectionString")rs.CursorType = adOpenStaticrs.LockType = adLockReadOnlyrs.CursorLocation = adUseClientSet rs.ActiveConnection = connrs.Source = "SELECT * FROM Employees WHERE FirstName + Lastname LIKE '%an%'"rs.OpenDo While Not rs.EOF   Response.Write rs("FirstName") & " " & rs("LastName") & "
" rs.MoveNextLooprs.Closeconn.CloseSet rs = NothingSet conn = Nothing%>
See also  How College Students Can Shape the Future of Tech Responsibility

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist