在'/ ODSeg1"应用程序服务器错误。
未将对象引用设置到对象的实例。
说明:执行当前Web请求期间,出现未处理的异常。请检讨有关错误的更多信息,堆栈跟踪,它起源于代码。
异常详细信息:System.NullReferenceException:未将对象引用设置到对象的实例
源错误:
Line 22: List<Product> products = new List<Product>();
Line 23: string cs = "Data Source=SERVER\\SERVERDB;Initial Catalog=lp;User ID=sa;Password=Pentag0n";
Line 24: SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings[cs].ConnectionString);
Line 25: SqlCommand cmd = new SqlCommand("select * from Products", con);
Line 26: con.Open();