Passing DataReader from Method to .cs page - use CommandBehavior.CloseConnection but connection not closing
问题 I use the following method in a class - which I call from .cs page filling a datareader: public static SqlDataReader getinfo(string username, string url) { //Initialise connection, string stored in Web.config SqlConnection conNs = new SqlConnection(ConfigurationManager.ConnectionStrings["conNs"].ConnectionString); SqlCommand cmdNs = new SqlCommand("usp_getinfo", conNs); cmdNs.CommandType = CommandType.StoredProcedure; cmdNs.Parameters.Add(new SqlParameter("@username", SqlDbType.VarChar, 50));