How to Change SQL Server Database Password


If you are connecting SQL Server Database from .NET Applications using a Connection string and you want to change the database password from your C# or VB.NET code, you can use ChangePassword method of SqlConnection class.

string conStrWithOldPassword = "Server=Test; Database=Test; uid=test; pwd=oldpassword;

string newPassword = "newpassword";

SqlConnection.ChangePassword(conStrWithOldPassword, newPassword);

 

 

About author


User avatar

Waqas Anwar

Founder of EzzyLearning.com, Senior Consultant, Microsoft .NET and Web Technologies

Comments