Highlighting found text in an sql search

Results 1 to 4 of 4

Thread: Highlighting found text in an sql search

  1. #1
    Ed Guest

    Default Highlighting found text in an sql search

    I am allowing users to search an sql database. The left side of my frame has a textbox named txtAdditional. The Page on the right side of my frame is using the query: "SELECT * from tblstuff where Title like &#039%" & request.form("txtAdditional") & "%&#039". Does anybody know of a way that I can put bold tags around any instance of a word that is returned in my recordset?<BR><BR>Thanks in advance,<BR><BR>Ed

  2. #2
    Ian Stallings Guest

    Default RE: Highlighting found text in an sql search

    Just an idea but you could take the resulting recordset and<BR>parse it using the vbScript Replace Function like so:<BR><BR>&#060;%<BR>strTxtAdditional = Request.Form(txtAdditional")<BR>strTxtAdditionalRe place = "&#060;b&#062;" & strTxtAdditional & "&#060;/b&#062;"<BR>strSelect = &#039define your select statement here<BR><BR>&#039this might be wrapped because of the message board<BR>strFinal=Replace(strSelect,strTextAdditio nal,strTxtAdditionalReplace,1,,1)<BR><BR>%&#062;<B R><BR>I hope this is clear, I wrote it on the fly.<BR>But you should see the general idea - after the<BR>recordset is returned, use the replace function to<BR>surround the variable searched for with the bold &#060;b&#062; tag

  3. #3
    Ed Guest

    Default RE: Highlighting found text in an sql search

    Thanks Ian!<BR><BR> It worked beautifully!<BR><BR>Ed

  4. #4
    davidku@rocketmail.com Guest

    Default RE: Highlighting found text in an sql search

    Hi Ed,<BR><BR>Could you pls send me the sample codings ?<BR><BR>My e-mail is davidku@rocketmail.com<BR><BR>Thanks very much !


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •