当前位置: 代码迷 >> VFP >> 下拉列表框怎么关联年份数据供选择
  详细解决方案

下拉列表框怎么关联年份数据供选择

热度:5862   发布时间:2013-02-26 00:00:00.0
下拉列表框如何关联年份数据供选择?
有一个表a.dbf中有一字段“加入时间”
值有很多,如:
2001-1-5
2001-3-9
2001-11-21
2002-1-1
2003-5-8
2003-10-12
2005-1-22
2005-3-1
......
请问,我在表单里有一下拉列表框值想从这个字段中读取年份不重复并多预留1年给用户选择,请问怎么做?一般下拉列表框关联值是用哪个方法比较多?
如上例下拉列表框中的值应该有:
2001
2002
2003
2005
2006(多预留值)
谢谢回答。

------解决方案--------------------------------------------------------
select dist year(加入时间) as MyYear from a.dbf ;
union select max(year(加入时间))+1 as MyYear from a.dbf ;
into cursor t1 order by MyYear

thisform.combo1.rowsource=null
thisform.combo1.rowsourcetype=6
thisform.combo1.recordsource=t1.MyYear
------解决方案--------------------------------------------------------
thisform.combo1.rowsourcetype=3
this.rowsource= "select dist year(加入时间) as MyYear from a.dbf ;
union select max(year(加入时间))+1 as MyYear from a.dbf ;
into array Myarray order by MyYear "

------解决方案--------------------------------------------------------
select dist year(加入时间) as MyYear from a.dbf ;
union select max(year(加入时间))+1 as MyYear from a.dbf ;
into cursor t1 order by MyYear

thisform.combo1.rowsource=null
thisform.combo1.rowsourcetype=6
thisform.combo1.rowsource=t1.MyYear



select dist year(加入时间) as MyYear from a.dbf ;
union select max(year(加入时间))+1 as MyYear from a.dbf ;
into array Myarray order by MyYear

thisform.combo1.rowsource=null
thisform.combo1.rowsourcetype=5
thisform.combo1.rowsource=Myarray
  相关解决方案