[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 231
  • Last Modified:

How can I determine from my vb app if my sybase password has expired

I need to be able to update my password on sybase, from my vb application, when it has expired. Something similar to the way the nt login works i.e. a few days before it is due to expire, when you logon you are asked if you would like to change it. You type in the old and new one and then it is updated

I know within sybase you can run the following to do the update

                      EXEC sp_password 'oldPassword', 'newPassword', 'loginName'

How can I tell if the password has expired or is there anywhere that I can set a flag to i.e. if its the last day of the month prompt the user that they need to change their password
0
INDYND
Asked:
INDYND
  • 2
1 Solution
 
David LeeCommented:
Sorry, I don't use or have access to Sybase so I can't answer the portion of your post about how to tell if the password has expired.  I can provide a sample, actually two samples, of ways to prompt the user to change their password at the end of the month.  The first sample tests to see if today's date is within x, I used 7 as an example,  days of the end of the month.  If it is, then it displays a dialog box advising the user that it's time to think about changing their password.  The second example is essentially the same as the first, but returns the number of days to the end of the month.  This allows for a dialog box like the one in Windows that reminds the user each day that their password expires in x days.  


    If PWExpirationNoticeA(Date, 7) Then
        MsgBox "Password expires within 7 days."
    End If
   
    intdaystillexpiration = PWExpirationNoticeB(Date)
    If intdaystillexpiration <= 7 Then
        MsgBox "Your password expires in " & intdaystillexpiration & " day(s)."
    End If

Public Function PWExpirationNoticeA(datDate As Date, intDaysInAdvance As Integer) As Boolean
    'Checks to see if the date passed is within a certain number of days of the end of the month.
    'Returns True if it is.
    Dim datEOM As Date
    datEOM = datDate + DateDiff("d", datDate, DateAdd("m", 1, datDate)) - Day(datDate)
    PWExpirationNoticeA = (DateDiff("d", datDate, datEOM) <= 7)
End Function

Public Function PWExpirationNoticeB(datDate As Date) As Integer
    'Calculates the number of days between the date passed and the end of the month for the date passed.
    'Returns the number of days difference.
    Dim datEOM As Date
    datEOM = datDate + DateDiff("d", datDate, DateAdd("m", 1, datDate)) - Day(datDate)
    PWExpirationNoticeB = DateDiff("d", datDate, datEOM)
End Function
0
 
David LeeCommented:
I held off on posting a recommendation in the hopes that Indynd would finalize the question.  In the absence of that I recommend accepting my answer (http:#11798142).
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now