Page 1 of 1

Changing the database account password

Posted: Mon 02 Nov 2020 01:00
by pconway
Hello, we recently purchased dotConnect for PostgreSQL. We're currently using it to connect to a local PostgreSQL database.

Is it possible to change the database account password using the dotConnect software? (i.e. not the password in the connection string, but the password that PostgreSQL server accepts)

Re: Changing the database account password

Posted: Tue 03 Nov 2020 17:39
by Shalex
Try this code:

Code: Select all

  var conn = new Devart.Data.PostgreSql.PgSqlConnection();
  conn.ConnectionString = "...";
  conn.Open();
  var cmd = conn.CreateCommand();
  cmd.CommandText = "ALTER USER username WITH PASSWORD 'newpassword'";
  cmd.ExecuteNonQuery();

Re: Changing the database account password

Posted: Mon 09 Nov 2020 15:33
by pconway
That worked. Thank you!