我目前正在处理一个项目,在该项目中我需要构建动态CONTAINSTABLE查询。我已经准备好了代码,它可以做一些类似的事情:
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
}我的问题是关于从可能破坏SQL查询的字符中清除搜索词。目前我只删除了"'“字符,因为这会破坏动态查询。
有没有其他我应该想到的字符可以中断查询?
谢谢
发布于 2012-06-15 19:08:30
ASCII键组合肯定会破坏这种动态查询,比如Ž等
https://stackoverflow.com/questions/7391696
复制相似问题