search text in files Hong Kong SAR
  • 12 years ago

     People upload doc files on my website. As soon as they upload a file, I would like to check if they contain a boolean search string ( ex: medical and ("colo*" and cancer)) . I need to check the file for a few of these search terms  and send an alert to the appropriate requestors.

    I am already using idexing services and if the resquestor asks for all files which contain a certain search term, I use a sql query on the catalog.

    The problem is: the file which is just uploaded is not necessary indexed yet. therefore it may not be found and checked. Is there a simple code or function  in (C# please) which will allow me to check if a file contains a search string?



  • 12 years ago


    I am not sure the above approach will be very effective.

    Doc files are from MS Word and will be in their proprietary format.  While it does store the text unscrambled in there, it does add extra characters to denote table endings etc.

    You are probably better using either regualar expressions to do the searching, or open the file using com objects and then using com interaction to search the file.  If you go the com route, then i think you will need MS Word installing on the web server to register the components necessary to interact with the word documents.

    Please feel free to correct me on that last point if i am wrong.


    Simon C

  • 11 years ago

    Hi, i am a beginner of and c# i have face a problem which is how to search the document content my document is save in sql server can u teach me hw to search it? thx

  • 11 years ago

    HI, is that your question you have store some text in any column in table and you would like to search some text in that content. Please specify your question more clearly so that i can give you reply.

  • 11 years ago

    Sorry about that, now the situation is like that: - i develop a system which could let user upload document like .doc / pdf / excel to database - i have save the document to image type in database, now the problem is how can i search that document content in database using query - i am using VS2008 and SQL Server 2005 Express - i have making research in internet and they result i get is using "contains" and "freetext", but i have try many time still cant get the thing i wan - is it SQL Server 2005 Express doesn't support this function or what

    Thx for all ur help

Post a reply

Enter your message below

Sign in or Join us (it's free).


Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“Never trust a programmer in a suit.” - Anonymous