pg.ddx.io  pgsql-docs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Problem about connect Postgre using ADO.NET
3+ messages / 3 participants
[nested] [flat]

* Problem about connect Postgre using ADO.NET
@ 2017-05-23 07:17  NGUYEN TRONG LANH <t_lanh@brycen.com.vn>
  0 siblings, 2 replies; 3+ messages in thread

From: NGUYEN TRONG LANH @ 2017-05-23 07:17 UTC (permalink / raw)
  To: pgsql-docs

Hello pgsql support team!

At first, forgive me if the content of the email is not your 
responsibility. I have problem when I try connect Postgre using ADO.NET, 
I not see PostgreSQL in Data Source list.

I have done to install Npgsql package, install Npgsql PostgreSQL 
extension but the problem is not solve.

Please let's me know if you have any ideas to solve this.

Thanks!


-- 
-------------------------------------------------------------------++
                                          
                |    |    |               BRYCEN VIETNAM Co.,Ltd.
               )_)  )_)  )_)              NGUYEN TRONG LANH
              )___))___))___)|            Development Department
             )____)____)_____)||          25 Nguyen Van Cu,Hue,Vietnam
           _____|____|____|____|||__      Email: t_lanh@brycen.com.vn
---------|                   /---------  Tel: +84-(0)234-6558332
    ^^^^^ ^^^^^^^^^^^^^^^^^^^^^           Mobile:+84-(0)93 8924 386
      ^^^^      ^^^^     ^^^    ^^        Website:http://www.brycen.com.vn
           ^^^^      ^^^
--------------------------------------------------------------------++

^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Problem about connect Postgre using ADO.NET
@ 2017-05-24 07:24  Charles Clavadetscher <clavadetscher@swisspug.org>
  parent: NGUYEN TRONG LANH <t_lanh@brycen.com.vn>
  1 sibling, 0 replies; 3+ messages in thread

From: Charles Clavadetscher @ 2017-05-24 07:24 UTC (permalink / raw)
  To: 'NGUYEN TRONG LANH' <t_lanh@brycen.com.vn>; pgsql-docs

Hello

> -----Original Message-----
> From: pgsql-docs-owner@postgresql.org [mailto:pgsql-docs-owner@postgresql.org] On Behalf Of NGUYEN TRONG LANH
> Sent: Dienstag, 23. Mai 2017 09:18
> To: pgsql-docs@postgresql.org
> Subject: [DOCS] Problem about connect Postgre using ADO.NET
> 
> Hello pgsql support team!
> 
> At first, forgive me if the content of the email is not your responsibility. I have problem when I try connect
> Postgre using ADO.NET, I not see PostgreSQL in Data Source list.
> 
> I have done to install Npgsql package, install Npgsql PostgreSQL extension but the problem is not solve.
> 
> Please let's me know if you have any ideas to solve this.

If I understand it correctly you installed Npgsql that is a driver for PostgreSQL using ADO.NET.
What is still missing is a data source, i.e. a DSN where you choose the driver and enter connection and login information.

How you create a DSN depends on the version of Windows you are on.

Hope this helps.
Regards
Charles

> Thanks!
> 
> 
> 
> --
> -------------------------------------------------------------------++
> 
>                |    |    |               BRYCEN VIETNAM Co.,Ltd.
>               )_)  )_)  )_)              NGUYEN TRONG LANH
>              )___))___))___)|            Development Department
>             )____)____)_____)||          25 Nguyen Van Cu,Hue,Vietnam
>           _____|____|____|____|||__      Email: t_lanh@brycen.com.vn <mailto:t_lanh@brycen.com.vn>
> ---------|                   /---------  Tel: +84-(0)234-6558332
>    ^^^^^ ^^^^^^^^^^^^^^^^^^^^^           Mobile:+84-(0)93 8924 386
>      ^^^^      ^^^^     ^^^    ^^        Website:http://www.brycen.com.vn
>           ^^^^      ^^^
> --------------------------------------------------------------------++



-- 
Sent via pgsql-docs mailing list (pgsql-docs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-docs



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Problem about connect Postgre using ADO.NET
@ 2017-06-10 23:20  Neil Anderson <neil@postgrescompare.com>
  parent: NGUYEN TRONG LANH <t_lanh@brycen.com.vn>
  1 sibling, 0 replies; 3+ messages in thread

From: Neil Anderson @ 2017-06-10 23:20 UTC (permalink / raw)
  To: NGUYEN TRONG LANH <t_lanh@brycen.com.vn>; pgsql-docs

On 2017-05-23 3:17 AM, NGUYEN TRONG LANH wrote:
> Hello pgsql support team!
>
> At first, forgive me if the content of the email is not your
> responsibility. I have problem when I try connect Postgre using ADO.NET,
> I not see PostgreSQL in Data Source list.
>
> I have done to install Npgsql package, install Npgsql PostgreSQL
> extension but the problem is not solve.

Hi, I use Npgsql in my project. I'm not sure what you mean by 'I do not 
see PostgreSQL in Data Source list', Npgsql does not discover the server 
for you, you must provide it with a connection string, create a 
connection and execute commands. Here is a code example:

var connString = 
"Host=localhost;Username=postgres;Password=passwrd;Database=postgres";

using (var conn = new NpgsqlConnection(connString))
{
     conn.Open();

     // Insert some data
     using (var cmd = new NpgsqlCommand())
     {
         cmd.Connection = conn;
         cmd.CommandText = "INSERT INTO data (some_field) VALUES (@p)";
         cmd.Parameters.AddWithValue("p", "Hello world");
         cmd.ExecuteNonQuery();
     }

     // Retrieve all rows
     using (var cmd = new NpgsqlCommand("SELECT some_field FROM data", 
conn))
     using (var reader = cmd.ExecuteReader())
         while (reader.Read())
             Console.WriteLine(reader.GetString(0));
}

For future reference Npgsql have wonderful documentation here 
http://www.npgsql.org/index.html, and they prefer questions be posted to 
Stack Overflow.

-- 
Neil Anderson
neil@postgrescompare.com
http://blog.postgrescompare.com


-- 
Sent via pgsql-docs mailing list (pgsql-docs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-docs



^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2017-06-10 23:20 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2017-05-23 07:17 Problem about connect Postgre using ADO.NET NGUYEN TRONG LANH <t_lanh@brycen.com.vn>
2017-05-24 07:24 ` Charles Clavadetscher <clavadetscher@swisspug.org>
2017-06-10 23:20 ` Neil Anderson <neil@postgrescompare.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox