Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. help with search code

help with search code

Scheduled Pinned Locked Moved ASP.NET
csharpquestionasp-netalgorithmshelp
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    luckyve
    wrote on last edited by
    #1

    Hi friends. I am cearting my website using Asp.net ( code C# ) and sqlserver2000... I need "search" in a webform. for example, when the user types " demo " in the textbox of the search page, then it should appear all the things in all pages of the website,which is correlate with the word "demo". Just like the search in codeproject. how can I do it ? I just know about searching with a specific field,like user name,age,... but I dont have any idea about a word searching ... is there any articles which can help me? Or can anyone help me to write ...? thanks alot.

    N 1 Reply Last reply
    0
    • L luckyve

      Hi friends. I am cearting my website using Asp.net ( code C# ) and sqlserver2000... I need "search" in a webform. for example, when the user types " demo " in the textbox of the search page, then it should appear all the things in all pages of the website,which is correlate with the word "demo". Just like the search in codeproject. how can I do it ? I just know about searching with a specific field,like user name,age,... but I dont have any idea about a word searching ... is there any articles which can help me? Or can anyone help me to write ...? thanks alot.

      N Offline
      N Offline
      nikneem2005
      wrote on last edited by
      #2

      You want to use a 'like' query on your database which allows you to search through string which 'looks like' your string... the syntax is easy select field1, field2 from table where field1 like '%demo%' this returns all rows where field1 contains the string 'demo'. However, you may consider using and/or functionality in your websearch, for example when a visitor enters demo+csharp in the textbox. Your query should look like this select field1, field2 from table where field1 like '%demo%' and field1 like '%csharp%' If the user enters 'demo csharp' as search text, you want select field1, field2 from table where field1 like '%demo%' or field1 like '%csharp%' This makes searching complicated. Afterwards you want to sort the result set having the most relevant match on top. For example you can count the number of matches for each result in the result set and order the result set depending on that number of matches having the most matches on top. You can make search functionality as easy or as complicated as you want... ;)


      I love it when a plan comes together http://www.zonderpunt.nl[^]

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups