如何在到期日前1个月出示 [英] How to Show 1 month before the expiry date

查看:75
本文介绍了如何在到期日前1个月出示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的所有



如何在Datagridview中的产品详细信息到期前获得1个月。



我在这里使用代码。



Dear All

How can I get 1 MONTH Before Expiry Date product Details in Datagridview.

Here I use code.

Dim strSQL As String = "SELECT * FROM ProductMasterA WHERE BatchExpiry <= DateAdd(+1,'M',BatchExpiry)"
Dim DaAp1 As New SqlDataAdapter(strSQL2, con)
 Dim Dset1 As New DataTable
 DaAp1.Fill(Dset1)
 DGV1.DataSource = Dset





请告诉我..



Please tell me..

推荐答案

更改你的查询:

Change your query to this:
Dim strSQL As String = "SELECT * FROM ProductMasterA WHERE BatchExpiry = (DateAdd(month,-1,getdate())"



但是,BatchExpiry需要是您想要的实际日期知道前一个月是什么。我使用了getdate()函数,它将在运行该查询之前一个月检查。现在使用它的方式不起作用,因为它只是一个字符串而不是一个变量。



该值应该来自哪里?


However, the "BatchExpiry" will need to be an actual date of when you are wanting to know what the month before is. I used the getdate() function and that will check a month before that query is run. The way you are using it now will not work as it is only a string and not a variable.

Where is that value supposed to come from?


这篇关于如何在到期日前1个月出示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆