<pre> Private Sub CheckLastPasswordChangedDate()
Try
Con = New SqlConnection(connectionstringhere)
Con.Open()
cmd = Con.CreateCommand()
cmd.CommandText = "SELECT PasswordLastChangedDate FROM YOURTABLENAME WHERE User_ID = '" & txt_Username.Text & "' and Password='" & EncryptData(txt_Password.Text) & "'"
rdr = cmd.ExecuteReader()
If rdr.Read Then
Label1.Text = rdr.GetValue(0).ToString
If Convert.ToDateTime(rdr.GetValue(0)).AddDays(passwordExpiresDays) < DateTime.Now Then
If MessageBox.Show("Your password has expired! Please change your password.", My.Application.Info.Title, MessageBoxButtons.OK, MessageBoxIcon.Asterisk) = System.Windows.Forms.DialogResult.OK Then
ForcePassChange_.Show()
Exit Sub
End If
End If
End If
Catch ex As Exception
MessageBox.Show(ex.Message, My.Application.Info.Title, MessageBoxButtons.OK, MessageBoxIcon.Error)
Finally
Con.Close()
Con.Dispose()
rdr.Close()
End Try
End Sub