如何在Gridview中添加新列.
问题描述:
嗨..
我在Gridview中使用两列.
我使用SQL查询/
在表中为此显示学生列表的第一列
在第二列中,我需要使用"SELECT COUNT(*)FROM table_name"显示记录数.
如何使用其他SQL查询添加第二列????
Hi..
Am using Two Columns in Gridview .
First Column to Display the List of Students in the Tables for this i used SQL query/
In the Second Column i need to Display the no of records using "SELECT COUNT(*) FROM table_name"
How to add the second column with another sql query ????
答
使用子查询,并通过此查询将网格视图与单个数据源绑定
选择st_name,(从有条件的学生中选择count(*)作为学生的count-st)
use sub query and bind the gridview with the single datasource with this query
select st_name,(select count(*) from student where condition) as count-st from student