Solved

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

Posted on 2004-08-12
5
175 Views
Last Modified: 2006-11-17
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
Comment
Question by:INDYND
  • 2
5 Comments
 
LVL 76

Accepted Solution

by:
David Lee earned 500 total points
ID: 11798142
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
 
LVL 76

Expert Comment

by:David Lee
ID: 12398498
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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now