从表格字段过滤句子中的单词 [英] Filtration of words of a sentence from table field

查看:76
本文介绍了从表格字段过滤句子中的单词的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请Plz先生帮帮我.

我在表中具有字段名称"ID"和关键字"的一些关键字.我想通过"TextBox"控件给出一个句子,如果句子的单词将与上表的关键字字段"匹配,那么它将在"datagridview"控件中显示该表的行. >
先生,请帮我非常必要.

Respected Sir Plz Help me.

I have some keywords in a table with field name "ID" and "Keywords". I want to give a sentence through a "TextBox" control, if that words of the sentences will match as the "Keyword fields" of the above table ,then it will display that rows of the table in "datagridview" Control.

Kindly Help me sir its very necessary.

推荐答案

做到这一点的一种方法是将表加载到DataTable中,然后遍历其Rows集合,或者使用DataReader读取表以依次获取每个关键字.

使用每个关键字,执行类似这样的操作非常简单:
One way to do this would be to either load your table into a DataTable and iterate over it''s Rows collection, or Read the table using a DataReader to get each keyword in turn.

Using each keyword it is fairly simple to do something like:
if (myTextBox.Text.Contains(theKeyword))
{
  // add that DataRow to a new DataTable (myMatchedDataTable)
}

// after iterating over all records
myDataGridView.DataSource = myMatchedDataTable;


这篇关于从表格字段过滤句子中的单词的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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