Advertisement
Guest User

lista_bases_pg

a guest
May 30th, 2015
272
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.58 KB | None | 0 0
  1.             NpgsqlConnection conn = new NpgsqlConnection();
  2.             conn.ConnectionString = "Server = localhost;Port = 5432;User Id=USERNAME;Password=PASSWORD;Database=postgres;CommandTimeout=1800000;Pooling=false;Timeout=1024;";
  3.             conn.Open();
  4.             NpgsqlDataReader dataset = new NpgsqlCommand("select datname from pg_database where not datistemplate", conn).ExecuteReader();
  5.             while (dataset.Read())
  6.             {
  7.                 comboBox1.Items.Add(dataset.GetString(0));
  8.             }
  9.             dataset.Close();
  10.             dataset.Dispose();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement