Click here to Skip to main content
15,886,788 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi, everyone
my question for today is how to search a string in a textfile using Sql database ....


thxxs in advance
my using visual studio 2012 ultimate
Posted
Comments
Tomas Takac 22-May-15 4:51am    
Why do you want to search a string in text file using SQL database?
Afzaal Ahmad Zeeshan 22-May-15 4:59am    
Because he wants to do something that is impossible. :D

See solution 1 for more. :-)
Member 10521418 22-May-15 5:11am    
it is impossible thats why i came here to ask .... i want fast search result ...
Member 10521418 22-May-15 5:12am    
of fast search ... bzy indexof and .contain method not giving me that much of speed ...
Tomas Takac 22-May-15 5:41am    
OK, so how long does the search take with String.IndexOf now? And what is the time you would like to achieve?

Wait, what? I didn't get your point. You want to search for the content in a text file (.txt) using SQL database?

They are two different things with similar functionality, to store the data on file system. You use .txt files to store plain text (or HTML content if formatting is intended) and you use SQL database to store data in a well organized way (in a table form with rows and columns!) and compact way.

In any way, they are not interconnected to each other. A text file cannot search for content in database (impossible!) and database even with triggers and stored procedures is not able to search for the content inside the text file. However, using VB.NET you somehow can search for similar content in either a text file or the SQL database.

How to search specific string into text file from VB.NET[^] (Text files)
How do i Search my record using Vb.net[^] (Database)
 
Share this answer
 
Comments
Member 10521418 22-May-15 5:10am    
afzaal i knew all this function as you mentioned .contain and indexof but by using those function searching result take more time ....
Tomas Takac 22-May-15 5:14am    
So you want to store your files in database and use full text search? Is that it?
Member 10521418 22-May-15 5:19am    
tomas- i want to search a pattern in a textfile or in a textbox which has multiple line and within a line i want to search a substring which match with database item ....
Member 10521418 22-May-15 5:20am    
i guess now you got my point ... forget textfile wat about multiple line textbox
Tomas Takac 22-May-15 5:29am    
Not really. For a textbox String.IndexOf or Regex is enough. Huge text files are a whole other story.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900