MVC5 / C# - Cannot perform runtime binding on a null reference
问题 I'm trying to figure out what's causing a Cannot perform runtime binding on a null reference error from this code: var query = "SELECT Id, UserName, List_Order, LoggedIn " + "FROM AspNetUsers" + "WHERE LoggedIn = 1" + "ORDER BY List_Order ASC"; var conn = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString); var cmd = new SqlCommand(query, conn); conn.Open(); var rdr = cmd.ExecuteReader(); var n = 0; while(rdr.Read()) { if