在vb.net中获取3个月后即将过期的项目

在vb.net中获取3个月后即将过期的项目,vb.net,vb.net-2010,Vb.net,Vb.net 2010,我目前正在做我的项目,我不知道从今天起3个月后将到期的项目的代码。有人能帮我吗?谢谢 Function popCat() Call populateOnGrid(da, dset, _ "Select * from tblItems where cdate(Expiry_Date)<>cdate('" & Date.Today.ToString("MM/dd/yyyy") & "') order by Category,Item_Name", "t

我目前正在做我的项目,我不知道从今天起3个月后将到期的项目的代码。有人能帮我吗?谢谢

Function popCat()
    Call populateOnGrid(da, dset, _
      "Select * from tblItems where cdate(Expiry_Date)<>cdate('" & Date.Today.ToString("MM/dd/yyyy") & "') order by Category,Item_Name", "tblItems", dgExpiry)
    lblrecFnd.Text = totRec & " Records/s found"
    Call formatGrid()
    Return True
End Function 
函数popCat()
调用populateOnGrid(da、dset、_
“按类别、项目名称、tblItems和dgExpiry选择*从tblItems中,其中cdate(到期日)cdate('”和Date.ToString(“MM/dd/yyyy”)&“)订单)
lblrecFnd.Text=totRec&“找到记录”
调用formatGrid()
返回真值
端函数

尝试以下方法:


cdate(到期日)=cdate(“&Date.Today.AddMonths(3.AddMonths.ToString)(“MM/dd/yyyy”)

如果需要,可以在SQL中执行:

Select * from tblItems where cdate(Expiry_Date) => DATEADD(month, 3, GETDATE())
这将为您提供所有在3个月或更长时间内到期的项目。或者您只希望在3个月内到期的项目