Dynamic FULL TEXT CONTAINSTABLE queries advice
I am currently working on a project where I need to build dynamic CONTAINSTABLE queries. I have code in place that does something like:
public string BuildQuery(string searchTerms)
{
searchTerms= searchTerms.Replace("'", "''");
string[] words = searchTerms.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
// Here I concatenate all the words into a string separated by AND and pass that to a SQL UDF
}
开发者_Python百科
My question is in regards to cleaning the search terms from characters that can break the SQL query. Currently I am only removing the "'" character since this will break the dynamic query.
Are there any other characters I should think of that can break the query?
Thanks
ASCII Key Combos will definitely break this dynamic query ,like Õ Ž etc
精彩评论