asp.net中的搜索查询问题 [英] Search Query Problem in asp.net

查看:54
本文介绍了asp.net中的搜索查询问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我面临在sqlserver中为搜索引擎编写搜索查询的问题.
我有一个文本框和一个按钮.
我想通过sqlserver查询来搜索按钮单击上的任何单词.但是此查询仅给出匹配的单词.
例如,当我输入tata时,它给出结果,但是当我们输入tata123时,它没有输出结果.

我的Sqlserver查询是:
"

Hi All,

I am facing problem to write search query in sqlserver for search engine.
I have a textbox and button.
I want to search any word on button click through sqlserver query.But this query gives only matching word.
For Example when I enter tata it gives the result but when we enter tata123 it gives no output.

My Sqlserver query is:
"

select distinct top 20 s.title,s.Short_Description,s.primary_keyword,p.cat_id,s.art_id from tbl_summary s inner join tbl_publishinfo as p on p.art_id =s.art_id where s.art_id in(select pi.art_id from tbl_publishinfo pi group by pi.art_id having(count(pi.art_id)=1)) and s.title like'%" & txttext & "%' order by s.art_id desc"

推荐答案


您要查找的内容可以使用全文目录轻松完成.
这将在多个字段中搜索部分或完整字符串.

看看以下链接.


全文描述
http://msdn.microsoft.com/en-us/library/ms142571.aspx [ ^ ]


使用方法:
http://msdn.microsoft.com/en-us/library/ms142583.aspx [ ^ ]
Hi,
What you are looking for can be done easily using full text catalog.
This searches for part or complete string on multiple fields.

Have a look on the following links.


Description of Full Text
http://msdn.microsoft.com/en-us/library/ms142571.aspx[^]


How to Use:
http://msdn.microsoft.com/en-us/library/ms142583.aspx[^]


使用
SQL通配符


for example

dim str as string
str= select * from tablename where column name='"&textboxName&"'



试试吧



try it


这篇关于asp.net中的搜索查询问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆