生成没有tabel字段的gridview [英] generate gridview without tabel field

查看:67
本文介绍了生成没有tabel字段的gridview的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两张桌子.1)userinfo

字段:

userid(primarykey)

名称



2)checkinout

字段:

用户ID

checktime

checktype



userinfo中的数据



userid 姓名

--------------

1        abc



checkinout中的数据



userid  checktime  checktype

----------------------------------

1  2013年1月1日上午10点  0

1  2013年1月1日下午5点   1

1  2013年2月1日上午10点  0

1  2013年2月1日下午5点   1



o表示intime,1表示正常运行时间



现在我必须在gridview中显示这样的数据方式...



userid 名称  银泰       外出时间           intype  outtype

----------------------------------------- --------------------------

1       abc  2013年1月1日上午10点  2013年1月1日下午5点  0       1



一个条件是,我不得更改表格字段。



怎么办这个?









i have two table.1)userinfo
fields:
userid (primarykey)
name

2)checkinout
fields:
userid
checktime
checktype

data in userinfo

userid   name
--------------
1         abc

data in checkinout

userid   checktime   checktype
----------------------------------
1   1/1/2013 10am   0
1   1/1/2013 5pm    1
1   2/1/2013 10am   0
1   2/1/2013 5pm    1

o is indicate intime,1 indicate outtime

now i have to display data in gridview like this way...

userid   name    Intime         outtime            intype   outtype
-------------------------------------------------------------------
1        abc   1/1/2013 10am   1/1/2013 5pm   0        1

one condition is that ,i have to not change the table field.

how to do this?





推荐答案

这称为枢轴。阅读一个很好的例子这里 [ ^ ]。
This is called a "pivot". Read up on a good example here[^].


这篇关于生成没有tabel字段的gridview的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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