Hi! all

Please help me. I have an ASP website, and I want to incoporate a search facility on it but I dont know how. can you please give me a starting point
your help will be apprecieted

Thanks
SC Sibiya
<EMAIL snipped>

Dani AI

Generated

Quick summary and a practical path forward (build vs outsource)

As mentioned, the fastest option is to outsource indexing (Google/Bing site search). That is fine for small public sites but gives up control and can show ads. As pointed out, if your content is dynamic you normally search the database; if it’s static you can either crawl the files or use a third‑party crawler. ’s point about portal tools is also valid — there are hosted site‑search services if you want an out‑of‑the‑box solution.

If you want to build a Classic ASP search against a SQL database, take these steps:

  • Add a simple GET search form (limit input length).
  • Sanitize and validate the query server‑side (trim, drop control chars).
  • Use parameterized queries or a stored procedure — do not concatenate raw input into SQL.
  • For small sites use LIKE queries; for larger sites use SQL Server Full‑Text Search (CONTAINS/CONTAINSTABLE) or an external engine (Lucene/Solr/Elasticsearch) for relevance and performance.
  • Paginate results, limit returned rows (TOP N), and create a simple ranking (matches in title > matches in body).

Minimal Classic ASP pattern (stored proc + ADO Command)

<%
Const adCmdStoredProc = 4
Const adVarWChar = 202
Const adParamInput = 1

q = Trim(Request.QueryString("q"))
If Len(q) > 0 Then
  If Len(q) > 200 Then q = Left(q,200)
  Set conn = Server.CreateObject("ADODB.Connection")
  conn.Open "YourConnectionString"

  Set cmd = Server.CreateObject("ADODB.Command")
  Set cmd.ActiveConnection = conn
  cmd.CommandType = adCmdStoredProc
  cmd.CommandText = "sp_Search"   ' stored proc does the LIKE/CONTAINS
  cmd.Parameters.Append cmd.CreateParameter("@q", adVarWChar, adParamInput, 200, "%" & q & "%")

  Set rs = cmd.Execute()
  ' render results...
  rs.Close
  conn.Close
End If
%>

Practical cautions

  • Leading wildcards (e.g. %term) prevent index use and are slow; prefer full‑text for flexible matching and ranking.
  • Always defend against SQL injection with parameters or stored procedures; see the OWASP guidance below.
  • For relevance, use full‑text indexes or an external search engine rather than many LIKE clauses.

Useful references: SQL LIKE operator (), Full‑Text Search overview (docs), and OWASP SQL Injection Prevention (cheat sheet).

Recommended Answers

All 3 Replies

You could just use a Google search engine,

they have the database and the search technology already available, for free

You can use this facility and you can also try your own define search facility. Check some portal who offer search facility within a site.

if ur content is dynamic then u have to use the database while searching, if its manual then search ur webpages.. very simple.. Google to search will not be a good idea as a programmer.. try.. u will get something..
Cheer!!!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.