I am having a problem with my npgsql connection to database. The point is that my application validates the user against db.If successful then redirects to the next page and display the SQL query. When the site is redirected and tries to read the query an exception says : Connection is not open. Anyone can help me with that?
string connectionString =
"Server=serverName;" +
"Database=dbName;" +
"User ID=" + strUsername + ";" +
"Password=" + strPassword + ";" +
"Port=portNo;";
NpgsqlConnection dbcon;
dbcon = new NpgsqlConnection(connectionString);
dbcon.Open();