Ravikant Upadhyay
Ravikant Upadhyay

Reputation: 405

fetch column value (date) from database and display row going to expire after one month

i have ms access database file which have many fields. clients, last billing, next billing... etc i want to fetch all rows having next billing date column and want to compare this with today and if it is one month elder than today than display it else dont display it. want to display record expiring in one month. my logic:-

if today >= last billing+11 months AND today < next billing than display next billing endif

do you have any other option ?

i dont know how to do it

Private Sub refreshlist()
    If Not cnn.State = ConnectionState.Open Then
    cnn.Open()
    End If
Dim sql As String = "select client,email,mobile from clientsData WHERE [NEXT BILLING]>"?????(what to do here)
    Dim da As New OleDb.OleDbDataAdapter(sql, cnn)
    Dim dt As New DataTable
    da.Fill(dt)
    Me.cviewexp.DataSource = dt
    cnn.Close()
End Sub

Upvotes: 0

Views: 247

Answers (1)

KekuSemau
KekuSemau

Reputation: 6852

I'm not sure I got you really right... does this help?

WHERE [NEXT BILLING] BETWEEN Dateadd('m', -1, Date()) AND Date()

Upvotes: 1

Related Questions