0

我正在使用 npgsql 来连接到我的 postgres 数据库。现在我想在我的 web.config 中添加连接,以便能够使用 asp.net 的 sql 数据源标记。

以下是我到目前为止所做的

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

但是一个错误显示登录错误,因为它使用我的个人资料帐户密码而不是 postgres 数据库密码。

知道如何解决吗?

这是我现在得到的错误:

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)

我想连接到 postgres no 到 sql server。

4

1 回答 1

1

标准

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

使用 Windows 安全性

Server=127.0.0.1;Port=5432;Database=myDataBase;Integrated Security=true;
于 2013-03-16T21:06:51.667 回答