首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > VB >

查询下一个月数据,该怎么解决

2012-01-28 
查询下一个月数据PrivateSublastmonth_click()Adodc1.RecordSourceselect*from2007wheredatediff( m ,日

查询下一个月数据
Private   Sub   lastmonth_click()
Adodc1.RecordSource   =   "select   *   from   2007   where   datediff( 'm ',日期,date())=0 "  
Adodc1.Refresh
End   Sub
'如何实现每点击一次自动查询下一个月的数据呢?

Private   Sub   lastmonth_click()
static   d   as   long  
d=0
d=d-1  
Adodc1.RecordSource   =   "select   *   from   2007   where   datediff( 'm ',日期,date())=d "  
Adodc1.Refresh
End   Sub

这样的语句为何不行?

[解决办法]
Private Sub lastmonth_click()
static d as long
d=0
d=d-1
Adodc1.RecordSource = "select * from 2007 where datediff( 'm ',日期,date())= " & d
Adodc1.Refresh
End Sub

热点排行
Bad Request.