Answer the question
In order to leave comments, you need to log in
How to connect to a database in PostgreSQL from a C# application?
In the application, I connect using the NPGSQL class
connectionStr = $"Server=localhost;Port=1488;User={LoginText.Text.Trim(' ')};Password={PasswordText.Text.Trim(' ')};Database=PrivateBD; ";
npgSqlConnection = new NpgsqlConnection(connectionStr);
try
{
npgSqlConnection.Open();
MessageBox.Show("Connected!", "Hurrah", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
Then it gives an error that the base I specified in the line does not exist!
Severity: FATAL Code: 3D000
But the same line only with a database named postgres establishes a connection with a bang. What could be the problem? The error appears on any database created by me in pdAdmin!
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question