SqlConnection.ChangePassword equivalent in VB6?!?!?!

  • We have a VB application that is now being used on SQL Server 2005 and we need to deal with the SQL password expiry. VB .Net onwards has a SQLConnection.ChangePassword(ConnString, NewPassword) that allows the password to be changed by the user, but is there a nice way to do this in VB6?

    Our solutions are:

    1. We report the message then the users have to go to their system administrators and get it changed.

    2. The system administrators remove the password expiry option from new logins.

    We reckon they will go with option 1 for a while and then rapidly switch to option 2 when the support calls get too much.

    Any ideas on a better solution?

  • The answer to this one is no, there is no nice way of doing it. There are some difficult ways of doing it however:

    1. Create an ADO.Net v2.0 component with a VB6 interface that calls the ChangePassword method, and call that from the VB6 code. This may involve installing the correct .Net runtime on all your clients machines.

    2. Create the component as detailed above and the setup DCOM so all your client machines talk to the component on the SQL Server machine. The second option means you don't have to install the .Net runtime anywhere but you do have to set up DCOM instead.

    3. Create a VB6 component that logs in as a user (or application role) with permissions to change the passwords of users and use T-SQL, and then call this when the user needs to change the password.

    From our position the administrative overheads for these were too much so our policy is use Windows Authentication or don't set the passwords to expire.

    Keith

  • Would calling sp_password stored procedure help you in this case? You could pass it as a command text with old, new and login parameters to achieve the same thing as ChangePassword.

    sp_password @old_password, @new_password, @login

    Regards,

    Husein, MCSD.NET

  • sp_Password would be needed to if we went with option three, but you have to use a different login as

    1. I don't want to give permissions to users to change passwords.

    2. Once their password has expired they cannot log in to change their own password.

    The beauty of the ChangePassword method is it will allow a user to connect using their old password and set the new one without giving them any special permissions.

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply