如何从gridview中的2列搜索数据? [英] How to search data from 2 columns in a gridview?

查看:117
本文介绍了如何从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 a StringBuilder.
Loop through the rows of GridView.
Inside the Loop, get the Column Value you want and append that to the StringBuilder.
After the loop, execute one query like

"SELECT something FROM TableName WHERE Id in (" + objStrBuilder + ")";


这篇关于如何从gridview中的2列搜索数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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