Results 1 to 2 of 2

Thread: Jr.Programmer

  1. #1
    Join Date
    Dec 1969

    Default Jr.Programmer

    How to search for a string or text in a database Ex :"ASP" and then i want to to change the color ot the string or text.How to write the code for this in VB or in ASP.

  2. #2

    Default RE: Jr.Programmer

    First search the the fields you want..something like this.<BR>strFName = Request.Form("firstname")<BR>strSQL = "SELECT fname FROM users where fname LIKE &#039%" & strfirstname & "%&#039"<BR>&#039&#039&#039&#039<BR>This will return on anything that has the same pattern.<BR>I enter bill, It will match "BILLy" or "BILLs", etc.<BR><BR>Then use the replace function when sending it to the browser.<BR>Do While Not RS.EOF<BR>Response.write (Replace(RS("fname"), strfname, ("&#060;B&#062;" & strfname & &#060;/B&#062;))) <BR>RS.MoveNext<BR>Loop<BR>&#039&#039&#039&#039<BR >This should make all of the matches bold. Its kind of a cheat, but it should work or at least give you an idea.<BR><BR>HTH,<BR>ASP_DRUG_DEALER

Posting Permissions

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