I cant get Npgsql connection string to work. I've tried some ways, for example
NpgsqlConnection conn = new NpgsqlConnection("Server=192.168.1.220;User Id=pgsql;Password=pgsql;Database=pgsql;");
or
var conn = new NpgsqlConnection("Host=192.168.1.220;Username=pgsql;Password=pgsql;Database=pgsql");
both throws me exception:
The type initializer for 'Npgsql.NpgsqlConnectionStringBuilder' threw an exception.
Im running Windows XP 64bit with VS 2010. I've already tried to connect from that machine to my pgsql server using ODBC or pgAdmin III - both works ok.
Could be this problem related to my Npgsql installation? I was not able to install it with NuGet, because I got following error:
PM> Install-Package Npgsql Installing 'Npgsql 3.2.1'. Successfully installed 'Npgsql 3.2.1'. Adding 'Npgsql 3.2.1' to Project. Uninstalling 'Npgsql 3.2.1'. Successfully uninstalled 'Npgsql 3.2.1'. Install failed. Rolling back... Install-Package : Could not install package 'Npgsql 3.2.1'. You are trying to install this package into a project that targets '.NETFramework,Version=v4.0,Profile=Client', but the packag e does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author. At line:1 char:16 + Install-Package <<<< Npgsql + CategoryInfo : NotSpecified: (:) [Install-Package], InvalidOperationException + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PowerShell.Commands.InstallPackageCommand
I've tried also to switch target framework to 4.0 or 3.5, but result was exactly the same. So I installed Npgsql simply by extracting .dll from MSI installation, then load it as reference.
Does anyone know how to make connection string to work?