在将第一个单词与行上的另一个文本匹配后,如何创建搜索?喜欢< b>按钮< u>塑料< / u> 15MM 4< u>< / u>< / b> [英] How do I create a search after spacing first word another text matching on row? Like <b>button <u>plastic</u> 15MM 4<u>hole</u></b>

查看:43
本文介绍了在将第一个单词与行上的另一个文本匹配后,如何创建搜索?喜欢< b>按钮< u>塑料< / u> 15MM 4< u>< / u>< / b>的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在间距后创建搜索第一个单词另一个文本匹配行



喜欢

按钮塑料 15MM 4



但是我想搜索如



塑料孔



多数民众赞成在一列列上匹配两条记录。如何创建搜索请帮助任何人



我正在创建搜索引擎我需要这些请帮助如果您知道或有任何想法请与我分享



我尝试了什么:



我想链接.Contains Method

我正在尝试sql通配符。

解决方案

检查一下,修改表名和列名



  //   string text =Button Plastic 15MM 4Hole;  
string text = 塑料孔;
string [] keys = text.Trim()。Split(' );

SqlConnection con = new SqlConnection( Data Source = .; Initial Catalog = karthik_test; Integrated Security = True);
SqlCommand cmd = new SqlCommand();
cmd.Connection = con;
string query = ,likePattern = ;

for int i = 0 ; i < keys.Length; i ++)
likePattern + = string .Format( %{0},keys [i]);
likePattern = likePattern.Trim()+ ;

query = likePattern.Length > 0 从TableKeywordSearch中选择*其中keywordcolumn如@keyword 从TableKeywordSearch中选择*;

cmd.CommandText = query;
cmd.Parameters.Add( @ keyword,likePattern);

SqlDataAdapter da = new SqlDataAdapter(cmd);
DataTable dtResults = new DataTable();
尝试
{
da.Fill(dtResults);
}
catch (例外)
{

;
}


我认为您正在寻找全文搜索 [ ^ ]。



更多

1. 开始使用全文搜索 [ ^ ]

2. SQL SERVER - 2008 - 创建全文目录和全文搜索 - 使用Pinal Dave访问SQL权限 [ ^ ]

3. Full-T示例ext搜索引擎|来自SQL Server Pro的SQL Server内容 [ ^ ]

How do I create a Search After Spacing First Word another Text matching on row

like
Button Plastic 15MM 4Hole

But I want to Search like

Plastic Hole

Thats matches two record on one column row. How to create a Search Please Help any one

I am Creating a Search Engine I required these Please help if u know or any idea please share with me

What I have tried:

I am trying to link .Contains Method
I am trying to sql wildcard.

解决方案

check this, modify the table name and column name

// string text = "Button Plastic 15MM 4Hole";
           string text = "Plastic Hole";
           string[] keys = text.Trim().Split(' ');

           SqlConnection con = new SqlConnection("Data Source=.;Initial Catalog=karthik_test;Integrated Security=True");
           SqlCommand cmd = new SqlCommand();
           cmd.Connection = con;
           string query = "", likePattern = "";

           for (int i = 0; i < keys.Length; i++)
               likePattern += string.Format("%{0}", keys[i]);
           likePattern = likePattern.Trim() + "%";

           query = likePattern.Length > 0 ? "select * from  TableKeywordSearch  where  keywordcolumn like @keyword " : "select * from  TableKeywordSearch";

           cmd.CommandText = query;
           cmd.Parameters.Add("@keyword", likePattern);

           SqlDataAdapter da = new SqlDataAdapter(cmd);
           DataTable dtResults  = new DataTable ();
           try
           {
               da.Fill(dtResults);
           }
           catch (Exception)
           {

               throw;
           }


I think you are looking for Full-Text Search[^].

More
1. Get Started with Full-Text Search[^]
2. SQL SERVER - 2008 - Creating Full Text Catalog and Full Text Search - Journey to SQL Authority with Pinal Dave[^]
3. Sample Full-Text Search Engine | SQL Server content from SQL Server Pro[^]


这篇关于在将第一个单词与行上的另一个文本匹配后,如何创建搜索?喜欢&lt; b&gt;按钮&lt; u&gt;塑料&lt; / u&gt; 15MM 4&lt; u&gt;&lt; / u&gt;&lt; / b&gt;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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