string connectionString = "Server=127.0.0.1;Port=5432;Database=myDataBase;User Id=myUsername; Password=myPassword;"; NpgsqlConnection conn = new NpgsqlConnection(connectionString); conn.Open(); C#连接PostgreSql需要的Npgsql.dll和Mono.Security.dll,Npgsql-2.2.3-net40.zip