从gridview 1读取数据并为gridview 2生成数据 [英] Read data from gridview 1 and generate data for gridview 2
问题描述
我已经导出了一个excel文件并将其显示在gridview中。
Gridview1
id name
1 ss
2 aa
现在我想在同一页面上使用数据库中的数据进行另一个gridview。但我只希望它显示匹配gridview 1的数据。
例如
这就是我在我的数据库中所拥有的/>
id name
1 ss
2 aa
3 bb
4 cc
i想要应用select语句从gridview1读取数据并获取类似数据
gridview 2
id姓名
1 ss
2 aa
i这样做我可以比较excel的数据文件到数据库。
我尝试过的事情:
so我只设法从excel文件获取数据到gridview 1
所以只需阅读GridView
行并创建一个包含所有值的字符串,如ss,aa
。将此参数作为参数发送到查询或存储过程,并使用IN子句
添加where条件。
Something喜欢...
SELECT * FROM 表 WHERE 名称 IN ( @ GridView1Names 跨度>)
i have exported an excel file and displayed it in a gridview.
Gridview1
id name
1 ss
2 aa
now i want another gridview on the same page with the data from the database. but i only want it to show the data that matches gridview 1.
For eg
this is what i have in my database
id name
1 ss
2 aa
3 bb
4 cc
i want to apply a select statement that reads the data from gridview1 and gets the similar data
gridview 2
id name
1 ss
2 aa
i am doing this so that i can compare the data from the excel file to the database.
What I have tried:
so far i have only managed to get the data from excel file to gridview 1
So just read theGridView
rows and make a string with all the values like"ss,aa"
. Send this as a parameter to the query or Stored Procedure and add a where condition withIN Clause
.
Something like...
SELECT * FROM Table WHERE Name IN (@GridView1Names)
这篇关于从gridview 1读取数据并为gridview 2生成数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!