private static IList<ProductInfo> GetOrdersBySql(string safeSQL) { List<ProductInfo> list = new List<ProductInfo>(); try { SqlDataReader read = DBhelperSQL.GetReader(safeSQL); if (read.HasRows) { while (read.Read()) { ProductInfo product=new ProductInfo(); //OrderInfo order = new OrderInfo(); //order.CustomerName = read.GetString(0); //order.OrderDate = read.GetDateTime(1); product.ProductId = read.GetString(2); product.ProductName = read.GetString(3); product.Price = read.GetInt32(4); product.Imagepath = read.GetString(5); product.Count = read.GetInt32(6); product.Description = read.GetString(7); list.Add(product); } } read.Close(); return list; } catch (Exception ex) { Console.WriteLine(ex.Message); throw ex; } } 就是把我注释的内容也添加到list当中去
侃侃无极
万千封印