Click here to Skip to main content
15,892,059 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hiii,
want to check each line in the multiline textbox to see if it (or a part of it) exists in the DB,
how to write sql command for this ..
thnnxs in advance
Posted

1 solution

First of all, split lines based on line breaks like
C#
List<string> lstLines = new List<string>(
                           txtYourTextBoxId.Split(new string[] { "\r\n" }, 
                           StringSplitOptions.RemoveEmptyEntries));</string></string>

Then you may query like-
SQL
SELECT COUNT(*)
FROM YourTableName
WHERE Colx LIKE '%'+@line+'%' --Colx is the column name with which you want to match


Now execute in the loop for all the values in lstLines. Now implement rest of your logic.

If you need further help, please let me know.

Hope, it helps :)
 
Share this answer
 
v3
Comments
Member 10521418 1-Jul-15 7:11am    
hey,buddy thnxxs for the answer ...
well i guess i must asked something along this query ...

" i want to search a pattern in a line which is inside the string like ex:-
(1st line in textbox)
"Thereisacat" this the line wat i want is "cat" From the string which is.inside a long string ....
my db :-
Dog
cat
fish
......
so now how to get that word from a long string....
or how to get a word(pattern) from a long string (line)
thxxxs in advance

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