如何在Gridview中添加新列. [英] How to Add new column in Gridview.

查看:561
本文介绍了如何在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


这篇关于如何在Gridview中添加新列.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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