如何从gridview中的2列搜索数据? [英] How to search data from 2 columns in a gridview?
本文介绍了如何从gridview中的2列搜索数据?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好!
我想从数据库中获取与网格视图的两列中的ID匹配的记录。我的查询是什么?任何人都可以帮助我吗?
解决方案
声明一个StringBuilder
。
循环通过行的GridView
。
在循环中,获取所需的列值并将其附加到StringBuilder
。
循环后,执行一个查询,如SELECT FROM FROM TableName WHERE Id in( + objStrBuilder + )
Hi guys!
I would like to get the records from the database that matches the IDs from the two columns of my grid view. What would be my query for it? Can anyone help me?
解决方案
Declare aStringBuilder
.
Loop through the rows ofGridView
.
Inside the Loop, get the Column Value you want and append that to theStringBuilder
.
After the loop, execute one query like"SELECT something FROM TableName WHERE Id in (" + objStrBuilder + ")";
这篇关于如何从gridview中的2列搜索数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文