日期:2014-05-19  浏览次数:20504 次

_________________________對於我來說:有點難度,高手你呢?
表裡有這樣一些記錄:
10點     10:50的火車  
11點     null      
12點     null          
13點     null          
14點     null          
15點     null          
16點     記得打電話提醒下火車  
16點     test  
16點     tt  
16點     笑話  
17點     sdfdsf  

請部怎樣顯示成:
10點     10:50的火車  
11點     null      
12點     null          
13點     null          
14點     null          
15點     null          
16點     1,記得打電話提醒下火車;2,test;3,tt;4,笑話;  
17點     sdfdsf  

請指教
謝謝!

------解决方案--------------------
看这么简单的界面设计,估计是数据库查询吧。

如果是SQL Server数据库查询,你大致可以写:

declare @t(field1 nvarchar(30) primary key,field2 nvarchar(3000))
insert @t(field1) select distinct field1 from [数据表]
update t set
field2=case t.field2 when null then s.field2 else t.field2+ ', '+s.field2
from @t as t
inner join [数据表] as s on t.field1=s.field1
where s.field2 is not null
select * from @t


如果是复杂的ui,那么应该使用正规的ui组件开发方法。例如对于asp.net来说,首先开发一个ascx,给它参数field1,它就能产生这个field1对应的所有field2组合起来的界面(也许只显示一行简单的文字,也许很复杂的一个小程序),然后使用SQL语句“select distinct field1 from [数据表]”查询数据产生数据源绑定到DataList,并把这个ascx组件放入模板中,接受field1数据进行展示。
------解决方案--------------------
...?