我想在gridview中一行水平显示日历日期 [英] i want to display calender dates horizontally in gridview in one row
本文介绍了我想在gridview中一行水平显示日历日期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想在gridview中以水平方式显示当前的日历日期,我想从sql表中获取数据,以某种方式显示,例如
i want to display current calender dates in horizontal fashion in gridview and i want to get data from sql table to be displayed under that in a way e.g.
1|2|3 |4|5 |6 |7|------
2|3|null|5|null|null|4|null
等等。
我需要一个程序,在这个程序中相同的日期得到起诉并在该数据位置只显示一个数字,例如我在表中在第2列中有三行相同的日期
and so on.
and i need a procedure in which same dates get sumed up and display only one number in that dat place eg in table that i have drawn in col 2 there are three rows of same dates
date1
date1 3 as date1 comes 3 times and date2 comes 2 times
date1 2
date2
date2
这一切都将通过1列命名,例如Tmp
and it all would be done through 1 column named eg Tmp
推荐答案
类似这样的东西
something like this
select dateCol, count(date) from datetable group by dateColorder by dateCol
将为您提供日期列表和每个日期的计数。
will get you a list of the dates and a count of each one.
有两种方法可以达到你的要求
1.
你应该写 Pivot sql查询并简单地将它绑定到gridview
2.
修复gridview隐藏的最后一列中的31列当月中的天数为30
然后你可以使用for循环填写数据
快乐编码!
:)
there are 2 ways to achieve your requirement
1.
you should write Pivot sql query and simply bind it to gridview
2.
take fix 31 columns in gridview invisible last column when days in month are 30
then you can use for loop to fill up data
Happy coding!
:)
这篇关于我想在gridview中一行水平显示日历日期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文