我有一个书籍表:
Title Board Class ---------------------------------------- Interactive English CBSE 9 Interactive Math ICSE 10 Hindi CBSE 9
我在asp.net网站上有一个搜索文本框.如果用户输入
文本框中的“9 CBSE”,我的选择查询应该返回Title Board Class ----------------------------------------- Interactive English CBSE 9 Hindi CBSE 9
如果用户输入“9英语”,则应返回
Title Board Class ------------------------------------------ Interactive English CBSE 9
那么我的选择查询应该将文本框值与所有这三列匹配?
我无法验证这一点,因为我现在无法访问Sqlserver,但这应该可行:select * from books where patindex('%' + left(_textbox_contents_, charindex(' ') - 1) + '%', Title + Board + Class) > 0 and patindex('%' + substring(_textbox_contents_, charindex(' ') + 1) + '%', Title + Board + Class) > 0
查看更多关于在C#中通过在SQL表的多列中拆分字符串进行搜索?的详细内容...
声明:本文来自网络,不代表【好得很程序员自学网】立场,转载请注明出处:http://haodehen.cn/did69418