0

I am using npgsql in ordre to connect to my postgres databse. Now I would like to do add the connection in my web.config so to be able to use the sql data source tag of the asp.net.

The following is what I have done so far

  <connectionStrings>
    <add name="constring" connectionString="Server=localhost; user id=postgres; Password=mypassword; Database='db_name';Trusted_Connection=True"/>
  </connectionStrings>

BUT an error is showing saying error to login since it using my pc profile account password rather than the postgres database password.

Any idea how t solve it?

This is the error i am getting now:

A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)

I want to connect to postgres no to sql server.

1 Answer 1

1

Standard

Server=127.0.0.1;Port=5432;Database=myDataBase;User Id=myUsername;Password=myPassword;

Using windows security

Server=127.0.0.1;Port=5432;Database=myDataBase;Integrated Security=true;
Sign up to request clarification or add additional context in comments.

2 Comments

port is not a key word in the connectionstring in the web.config because I have already tried it @Mikatsu
I already managed to do a connection from codebehind c# using npgsql. What I would like some guidance on how to do it in the web.config @Mikatsu

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.