gestion de l'exception

connexion
Nicolas MAYE 2 years ago
parent 756bf52499
commit 5b996f98f0

@ -32,8 +32,17 @@ namespace LinqToPgSQL
List<Inscrit> ListeInscrits = new List<Inscrit>(); List<Inscrit> ListeInscrits = new List<Inscrit>();
var conn = new NpgsqlConnection(connString); var conn = new NpgsqlConnection(connString);
Console.Out.WriteLine("Ouverture de la connection"); Console.Out.WriteLine("Ouverture de la connection"); try
conn.Open(); {
conn.Open();
}
catch
{
conn.Close();
Environment.Exit(0);
}
var AllInscrit = new NpgsqlCommand("SELECT * FROM Inscrit", conn); var AllInscrit = new NpgsqlCommand("SELECT * FROM Inscrit", conn);

Loading…
Cancel
Save