Rod
Member
Hi Guys,
Hope you are all well?
I am writing a search ability in my code that will take a string, capture the keywords and then return all entries from a database that contain those words in a specified column. It works!!! Except for one thing.
(Where xSQL = my SQL statement passed to the database (handled elsewhere) and strComments is the sentance to be split)
So this works absolutley fine.
Next, how would I capture a carriage return? As the control the user types the keywords in is a multiline textbox, it is possible.
Thanking you in advance
Rod
Hope you are all well?
I am writing a search ability in my code that will take a string, capture the keywords and then return all entries from a database that contain those words in a specified column. It works!!! Except for one thing.
(Where xSQL = my SQL statement passed to the database (handled elsewhere) and strComments is the sentance to be split)
VB.NET:
[COLOR="Blue"]Private Sub [/COLOR]SearchComments([COLOR="blue"]ByRef[/COLOR] xSQL [COLOR="blue"]As String[/COLOR], [COLOR="blue"]ByVal [/COLOR]strComments [COLOR="blue"]As String[/COLOR])
Const Space As Char = [COLOR="Red"]" "c[/COLOR]
Const Comma As Char = [COLOR="Red"]","c[/COLOR]
[COLOR="Blue"]Dim [/COLOR]Delimeters() [COLOR="blue"]As Char [/COLOR]= {Space, Comma}
[COLOR="blue"]Dim [/COLOR]ResultArray [COLOR="blue"]As String[/COLOR]() = strComments.Split(Delimeters)
xSQL &= [COLOR="red"]"AND (vw_ContactSessionsOSS.Comments LIKE '%"[/COLOR]
[COLOR="blue"]Dim [/COLOR]SubString [COLOR="blue"]As String[/COLOR]
[COLOR="blue"]For Each [/COLOR]SubString [COLOR="blue"]In [/COLOR]ResultArray
xSQL &= SubString & [COLOR="red"]"%' "[/COLOR]
[COLOR="blue"]If Not [/COLOR]SubString = ResultArray(UBound(ResultArray)) [COLOR="blue"]Then[/COLOR]
xSQL &= [COLOR="red"]"OR vw_ContactSessionsOSS.Comments LIKE '%"[/COLOR]
[COLOR="blue"]Else[/COLOR]
xSQL &= [COLOR="red"]") "[/COLOR]
[COLOR="blue"]End If[/COLOR]
[COLOR="blue"]Next[/COLOR]
[COLOR="blue"]End Sub[/COLOR]
So this works absolutley fine.
Next, how would I capture a carriage return? As the control the user types the keywords in is a multiline textbox, it is possible.
Thanking you in advance
Rod