• Hello and welcome to our new forums. We upgraded our forum sites to a more robust and modern system which we hope you will enjoy. Be sure to check out your profile by clicking the button on the top right and configure your preferences, signature, time zone, avatar, etc. as you wish. If you need help with using this new forum'ware try the help link on the bottom right.

    Click here to review your account now.

Get Expiry Date

Jake

New member
Joined
Apr 13, 2019
Messages
2
Location
Philippines
Programming Experience
1-3
Hi,
Question, I was trying to get expiry date from my database, I already got those list display on my Listview.
But when Im trying to update the year. Still showing on my list.

sample Date today is 13-Apr-2019, i want to display those upcoming expiry +30 Days.
but if I update it to 13-Apr-2020, still showing.

My code i use.

"Select * from TblEmployee where IDExpiry<=@IDExpiry"
siemdi.Parameters.Add("@IDExpiry", OleDbType.Date).Value = DateTime.Today.AddDays(30)
 

jmcilhinney

VB.NET Forum Moderator
Staff member
Joined
Aug 17, 2004
Messages
14,047
Location
Sydney, Australia
Programming Experience
10+
Please show all the relevant code as you are executing it. Also, what type of database are you using and what is the data type of the IDExpiry column?
 

Jake

New member
Joined
Apr 13, 2019
Messages
2
Location
Philippines
Programming Experience
1-3
im using Access Database.

my complete code.

Dim dtt As New DataTable
Dim adp As New OleDbDataAdapter
LVExpired.Clear()
LVExpired.Visible = True
LVExpired.View = View.Details
LVExpired.GridLines = True
LVExpired.FullRowSelect = True
LVExpired.Columns.Add("Empl. ID", 100)
LVExpired.Columns.Add("Empl. Name", 120)
LVExpired.Columns.Add("ID Exp.", 100)
Dim Load As String = "Select * from TblEmployee where IDExpiry<=@IDExpiry"
siemdi = New OleDbCommand(Load, cns)
siemdi.Parameters.Add("@IDExpiry", OleDbType.Date).Value = DateTime.Today.AddDays(30)
Try
cns.Open()
adp = New OleDbDataAdapter(siemdi)
adp.Fill(dtt)

For Each row In dtt.Rows
PopulateExpired(row(2).ToString, row(5).ToString, row(14).ToString)
Next
dtt.Rows.Clear()
cns.Close()
Catch ex As Exception
MsgBox(ex.Message)
cns.Close()
End Try
 
Last edited:
Top Bottom