从DB到gridview,然后计算将结果添加到新列 [英] From DB to gridview, then compute add result to new column

查看:121
本文介绍了从DB到gridview,然后计算将结果添加到新列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个问题,我想从db获取所有值并在Gridview中查看所有值。获得数据后,我想将文本框中的值与gridview / db中的所有行匹配。然后将结果放入相同/其他gridview中的新列





ex。



 TextBox1.Text = Hello Everyone!我是你的.. ; 





我只想知道如何在c#
$ b $中使用简单的字符串匹配来匹配此处的文本b



 RowId |句子| Percntg Match(新增列)
1 |你好!我... | 0.103453
2 |您好!我的名字.. | 0.237657
3 |嘿伙计!怎么... | 0.15342





我希望你能理解我想要得到的结果

解析方案

从数据库中获取数据后,在结果数据集中添加另一列,

将保存您的运算结果。在绑定到网格之前,根据需要处理它(即检查特定列值与文本框文本匹配)&在新添加的列中更新结果。完成后将其绑定到网格。







使用网格的行数据绑定事件。将数据集原样绑定到grid.In行数据绑定事件。处理每个网格行以查看条件&在网格视图中更新结果列。



对于行数据绑定,请检查此link

I have a problem, I'd like to get all the values from db and view it all in a Gridview. Once I get the data, I'd like to match the value in the textbox to all rows in gridview/db. Then put the result to the new column in the same/other gridview


ex.

TextBox1.Text = Hello Everyone! I'm your.. ; 



I only want to know how to match the text in here while using a simple string match in c#


RowId   |   Sentence                |    Percntg Match (newly added column)
  1     |  Hello there! I'm...      |      0.103453
  2     |  Hi there! My name..      |      0.237657
  3     |  Hey dude! How are ...    |      0.15342



I hope you understand what I result I want to get

解决方案

After getting data from database,Add another column in result data set which
will hold your operation result. before binding to grid ,process it as you want (ie. check particular column value match with text box text) & update result in newly added column. After finishing it bind it to grid.

Or

Use row data bound event of grid. Bind your data set as it is to grid.In row data bound event .Process each grid row for your check condition & update result column in Grid view.

For row databound , check this link


这篇关于从DB到gridview,然后计算将结果添加到新列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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