vb.net - search for a word in entire table - MySQL -
Currently using the following code to search for a word in the entire table,
String = "sample" as a slow search string as mysql = "SELECT * FROM myTable" & amp; _ "Where '%' as the call 1 & amp; Search & amp; "% '" & Amp; _ "Or '%' like call 2 & amp; Search & amp; "% '" & Amp; Like "_" or 3 as'% '& amp; Search & amp; "%'" & Amp; _ "or call 4 & quot; & quot; & amp;"% & quot; "
but increases the number of columns but if the query becomes more difficult, then anyone can suggest some alternative methods to do this.
Use a loop to make your string a program In this example, you only need to add your column to the array.
forms of retarded form In the form of the string = = "sample" = dimension (string) = {"col1", "col2", "col3", "col4"} as blurted boolean = true dull mysql string = "select * from myTable WHERE "Arrays in the string for each string if b mysql = mysql & str +" such as '% "& amp; Search and"%' "Other Mysql = mysql & amp;" or "& Str & Amp; "Preferences '%" & Search & amp; "%'" End if B = False Forwarded Debug. Published (mysql)
Output >>
< Pre> SELECT * myTable where '% sample%' like call 1 or '% sample' like 'call 2' or '3% Sample% 'or 3 like'% sample ''
Comments
Post a Comment