Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error ConnectionString in Helper.cs in PostgreSQL #18

Closed
VNA74 opened this issue May 26, 2023 · 8 comments
Closed

Error ConnectionString in Helper.cs in PostgreSQL #18

VNA74 opened this issue May 26, 2023 · 8 comments

Comments

@VNA74
Copy link

VNA74 commented May 26, 2023

In ConnectionString not present database name Database=" + databaseName

public void CreateDatabaseIfNotExists(string server, string userId, string password, string databaseName) { using (var conn = new NpgsqlConnection("Server=" + server + ";User Id=" + userId + ";Password=" + password))

aelassas added a commit that referenced this issue May 26, 2023
@aelassas
Copy link
Owner

Database field is not required in the connection string in Helper.cs because we use CREATE DATABASE command later on:

var command2 = new NpgsqlCommand("CREATE DATABASE " + databaseName + ";", conn)

@VNA74
Copy link
Author

VNA74 commented May 26, 2023

When run conn.Open(); without Database I get error. By default PostgreSQL try find database as User Id

@aelassas
Copy link
Owner

Fixed.

Check out this commit.

@VNA74
Copy link
Author

VNA74 commented May 27, 2023

Thanks It works. You can also add a port to connect

aelassas added a commit that referenced this issue May 27, 2023
@aelassas
Copy link
Owner

@VNA74

I added the port.

Check out this commit.

@VNA74
Copy link
Author

VNA74 commented May 28, 2023

great, it works

@aelassas
Copy link
Owner

aelassas commented Jun 4, 2023

@VNA74 I released the fix in the v6.6.

@marijazvarych3
Copy link

When run conn.Open(); without Database I get error. By default PostgreSQL try find database as User Id

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants